I have a Maven project that is intended to be a demo of one of our products, which is itself a fat jar with several dependencies. We distribute the source code of these demos as a .zip
file containing a self-contained Maven project that our customers can build and play around with.
I'm using the maven-assembly-plugin
to do a custom assembly of our distributed demos project. I'm using a dependencySet
to place our product's JAR in a lib/
directory in the final assembly. The problem is, the maven-assembly-plugin
splits up our fat jar into the normal jar (without dependencies), and all of the dependencies of the jar. I would rather the plugin not split up the fat jar, and simply place the fat jar in the lib/
directory. Is there a way to do this?
assembly.xml:
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib/</outputDirectory>
<includes>
<include>our-product:jar</include>
</includes>
<outputFileNameMapping>our-product.jar</outputFileNameMapping>
</dependencySet>
</dependencySets>
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>DemoManager</mainClass>
</manifest>
</archive>
<!-- Generates jar -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- Generates distributed demo project -->
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-jar</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>