title: maven assembly, avoiding full path in zip file?
body: <p>I have a multi-module project which contains 2 modules (each with its own pom.xml) and a parent pom.xml pointing to those modules.</p>
  
  <p>When I run "mvn clean package" on the parent pom, each project ends up with a zip file under it's own target folder. I would like to package a zip file containing each module zip file under the zip file's root folder but I am having some issues doing so.</p>
  
  <p>I have created an assembly file in the parent pom.xml folder:</p>
  
  <pre><code>&lt;!-- Release distribution --&gt;
  &lt;assembly&gt;
  &lt;id&gt;release&lt;/id&gt;
  &lt;formats&gt;
      &lt;format&gt;zip&lt;/format&gt;
  &lt;/formats&gt;
  &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt;
  
  &lt;fileSets&gt;
      &lt;fileSet&gt;
          &lt;directory&gt;${basedir}/projectA/target/&lt;/directory&gt;
          &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
          &lt;includes&gt;
              &lt;include&gt;*.tar.gz&lt;/include&gt;
          &lt;/includes&gt;
      &lt;/fileSet&gt;
      &lt;fileSet&gt;
          &lt;directory&gt;${basedir}/projectB/target/&lt;/directory&gt;
          &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
          &lt;includes&gt;
              &lt;include&gt;*.tar.gz&lt;/include&gt;
          &lt;/includes&gt;
      &lt;/fileSet&gt;
  &lt;/fileSets&gt;
  &lt;/assembly&gt;
  </code></pre>
  
  <p>While the above works, if we start adding more and more modules to this project, it gets very annoying to have to keep updating this assembly.</p>
  
  <p>Ideally I'd like for it to automatically just go into every target folder for a module and get a zip file in there.</p>
  
  <p>This can be accomplished by doing </p>
  
  <pre><code>...
  &lt;fileSet&gt;
          &lt;directory&gt;${basedir}&lt;/directory&gt;
          &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
          &lt;includes&gt;
              &lt;include&gt;**/target/*.tar.gz&lt;/include&gt;
          &lt;/includes&gt;
      &lt;/fileSet&gt;
  </code></pre>
  
  <p>however the issue here is the zip file will contain full paths, so rather than having zip files inside the root folder, the zip file will have projectA/target/xxxx.zip and projectB/target/xxxx.zip which is exactly what I do not want.</p>
  
  <p>Is there any way to make a simple assembly in maven so I don't have to update it everytime I add a new module and not have full paths inside the zip?</p>
  
  <p>EDIT 1</p>
  
  <p>It looks like this is simply not possible. Either you get a nicely structured zip file with a hard to maintain assembly or you get an easy to maintain but annoingly structured zip file.
  I'll leave this unanswered until I can find a proper solution</p>
  
  <p>EDIT 2</p>
  
  <p>Back at looking for a solution for this again. Regarding khmarbaise solution posted below there are a few issues with it:
  - It relies on assemblies of dependencies, in my case I just want an assembly of assemblies (Which are more like fileSets and not dependencyset)
  - The fact that it relies on me manually specifying which projects I want to have included in the assembly. I already have this information in the parent pom which specifies which modules should be built, so if I remove a module from the parent pom so that it is no longer built, the assembly should already know that and skip picking that project (Reason for which fileset seems to work so well except for the shitty, non-controllable path inside the assembly zip). I shouldnt have to manually mess with what modules I want included other than simply removing adding modules from the pom I am running the assembly from.</p>
  
  <p>Has nobody really ever run into a similar problem?</p>