Nandor Nandor - 4 years ago 140
Java Question

Maven assembly plugin creates two unexpected jars

I want to use maven-assembly-plugin to pack external dependencies into the application's jar file. When I call mvn install it creates two jar files, one with and one without the dependencies. (appname-version.jar and appname-version-jar-with-dependencies.jar)

My question is that why it creates two jar files?

Here is the plugin: (im not using any other plugin at the moment)

<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->

Thank you!

Answer Source

You need to update the maven-jar-plugin to avoid creating the default jar. This is done by adding <phase>none</phase> to its execution details:


All the resources/classes are still moved to the target folder, to the maven-assembly can build itself correctly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download