We're trying to build a client jar that includes unpacked dependent jar's. And the manifest should have class-path
entries to the dependent jars. The snippet below works but the jars are unpacked - how can we stop the jars from being unpacked?
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Indeed, assembling using
jar-with-dependencies
causes maven to unpack all the dependencies as${assembly.dependencySets.dependency.unpack}
is set totrue
in the corresponding assembly descriptor.A simple fix would be to provide an assembly descriptor similar to the
jar-with-dependencies.xml
and modify${assembly.dependencySets.dependency.unpack}
tofalse
, like this:EDIT: For an unknown reason, the behavior when using
<unpack>false</unpack>
is not exactly the same and it seems necessary to add<outputDirectory>/</outputDirectory>
to the fileSet or you don't get the expected result.