title: Maven : Packaging and Dependency Resolution
body: <p>My Maven project Project1 has only one dependency which is the Utils(which is again my local Maven project). I have to distribute my project as a Standalone jar to be used in a client application. I used the following maven assembly plugin to generate the fat jar.</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;mainClass&gt;myMainClass&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
                  &lt;descriptorRefs&gt;
                      &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                  &lt;/descriptorRefs&gt;
                  &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;make-assembly&lt;/id&gt; &lt;!-- this is used for inheritance merges --&gt;
                      &lt;phase&gt;package&lt;/phase&gt; &lt;!-- bind to the packaging phase --&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>This fat jar now contains all the dependencies of Utils project packaged. This will bring in the dependency resolution issues if the client application also uses a Maven dependency, but has a different version. </p>
  
  <p>Is there a way such that I can package the Utils without its dependencies and let Maven download the Utils dependencies at the client location?</p>
  
  <p>My Project1 dependencies:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sample&lt;/groupId&gt;
          &lt;artifactId&gt;Utils&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt; 
  </code></pre>
  
  <p>My Utils dependencies:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-datatype-jdk8&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.module&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-module-parameter-names&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-datatype-jsr310&lt;/artifactId&gt;
          &lt;version&gt;2.9.8&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;${version.log4j}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;${version.log4j}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
          &lt;version&gt;${version.log4j}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
      &lt;/dependency&gt;
   &lt;/dependencies&gt;
  </code></pre>