views:

557

answers:

3

I am using Assembly plugin for maven to create an installation package.

For my packaging requirement, I need to split artifacts generated during the build and all dependencies into separate folders.

My current Assembly manifest is as follows:

<moduleSets>
  <moduleSet>
    <includes>
      <include>test:test</include>
    </includes>
    <binaries>
      <includeDependencies>false</includeDependencies>
      <outputDirectory>lib/custom/${artifactId}</outputDirectory>
      <unpack>false</unpack>
    </binaries>
  </moduleSet>
  <moduleSet>
    <includes>
      <include>test:test</include>
    </includes>
    <binaries>
      <includeDependencies>true</includeDependencies>
      <excludes>
        <exclude>test:test</exclude>
      </excludes>
      <outputDirectory>lib/thirdParty/</outputDirectory>
      <unpack>false</unpack>
    </binaries>
  </moduleSet>
</moduleSets>

First moduleset correctly generates only currently built assembly. However, thirdParty includes the currently built assembly as well. How would I go about excluding the files already included in the first set?

Thanks

A: 

One kludgy way to do it is with the maven-antrun-plugin and an ant task. Iterate the contents of lib/custom/${artifactId} and remove any files from lib/thirdParty.

Rich Seller
A: 

You might want to look at appassembler-maven-plugin. It lets you dump all your runtime dependency jars in a directory. You might be able to hack that up to put your main jar in one folder and then dump the dependencies into another.

sal
+1  A: 

What about using dependency:copy-dependencies? I use that to copy all deps to target/lib .

Ondra Žižka
Using this with excludeTransitive and excludeScope would be a nice simple way of doing this.
sal