title: How to copy all maven dependencies when packaging using assembly file?
body: <p>I have a project A that has some dependencies in its POM.
  A has a parent project B and a grand-parent project C.</p>
  
  <p>When packaging A, using an assembly file, I'd like to put all necessary dependencies for A inside a directory in the packaged project.</p>
  
  <p>Currently the I can only package the dependencies that are in A's POM.
  I didn't find a way to package B's and C's dependencies that are necessary to A.
  Do you know how I could do that?</p>
  
  <p>Here's the assembly XML:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin    /assembly/1.1.2"  
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"&gt;  
      &lt;id&gt;bundle&lt;/id&gt;
      &lt;formats&gt;
          &lt;format&gt;zip&lt;/format&gt;
      &lt;/formats&gt;
      &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt;
      &lt;dependencySets&gt;
          &lt;dependencySet&gt;
              &lt;!--Include runtime dependencies--&gt;
              &lt;outputDirectory&gt;${ser.depdir}&lt;/outputDirectory&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependencySet&gt;
      &lt;/dependencySets&gt;
  
      &lt;fileSets&gt;
          &lt;fileSet&gt;
              &lt;!--Get the generated application jar--&gt;
              &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
              &lt;outputDirectory&gt;&lt;/outputDirectory&gt;
              &lt;includes&gt;
                  &lt;include&gt;*.jar&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/fileSet&gt;
          &lt;fileSet&gt;
              &lt;!--Get application resources--&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;outputDirectory&gt;conf&lt;/outputDirectory&gt;
              &lt;includes&gt;
                  &lt;include&gt;*.properties&lt;/include&gt;
                  &lt;include&gt;*.sh&lt;/include&gt;
                  &lt;include&gt;log4j2.xml&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/fileSet&gt;
          &lt;fileSet&gt;
              &lt;!--Get misc user files--&gt;
              &lt;directory&gt;${project.basedir}&lt;/directory&gt;
              &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
              &lt;includes&gt;
                  &lt;include&gt;README*&lt;/include&gt;
                  &lt;include&gt;LICENSE*&lt;/include&gt;
                  &lt;include&gt;NOTICE*&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/fileSet&gt;  
      &lt;/fileSets&gt;
  &lt;/assembly&gt;  
  </code></pre>
  
  <p>And A's POM:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;group&lt;/groupId&gt;
          &lt;artifactId&gt;ser&lt;/artifactId&gt;
          &lt;version&gt;1.0.6-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;artifactId&gt;ser-art&lt;/artifactId&gt;
      &lt;name&gt;SER ART&lt;/name&gt;
      &lt;description&gt;desc&lt;/description&gt;
      &lt;properties&gt;
          &lt;ser.depdir&gt;${project.artifactId}-dependencies&lt;/ser.depdir&gt;
      &lt;/properties&gt;
      &lt;build&gt;
          &lt;testResources&gt;
              &lt;testResource&gt;
                  &lt;directory&gt;src/test/resources&lt;/directory&gt;
              &lt;/testResource&gt;
              &lt;testResource&gt;
                  &lt;directory&gt;../config/test&lt;/directory&gt;
              &lt;/testResource&gt;
          &lt;/testResources&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;mainClass&lt;/mainClass&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;${ser.depdir}/&lt;/classpathPrefix&gt;
                          &lt;/manifest&gt;
                          &lt;manifestEntries&gt;
                              &lt;Class-Path&gt;./conf/&lt;/Class-Path&gt;
                          &lt;/manifestEntries&gt;
                      &lt;/archive&gt;
                      &lt;excludes&gt;
                          &lt;exclude&gt;*.properties&lt;/exclude&gt;
                          &lt;exclude&gt;*.sh&lt;/exclude&gt;
                          &lt;exclude&gt;log4j2.xml&lt;/exclude&gt;
                      &lt;/excludes&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                      &lt;descriptors&gt;
                          &lt;descriptor&gt;${basedir}/src/main/assembly.xml&lt;/descriptor&gt;
                      &lt;/descriptors&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;single&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
               &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.8&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/${ser.depdir}&lt;/outputDirectory&gt;
                              &lt;includeScope&gt;runtime&lt;/includeScope&gt;
                              &lt;overWriteReleases&gt;false&lt;/overWriteReleases&gt;
                              &lt;overWriteSnapshots&gt;false&lt;/overWriteSnapshots&gt;
                              &lt;overWriteIfNewer&gt;true&lt;/overWriteIfNewer&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;group&lt;/groupId&gt;
              &lt;artifactId&gt;ser-commons&lt;/artifactId&gt;
              &lt;version&gt;1.0.6-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;group&lt;/groupId&gt;
              &lt;artifactId&gt;utilities-lib&lt;/artifactId&gt;
              &lt;version&gt;1.0.6-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.2.2&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>