In my pom.xml
I use the maven-assembly-plugin to create an executable jar-with-dependencies when running "mvn clean install".
Now it first creates the non-executable "name-version.jar" and after that the "name-version-jar-with-dependencies.jar".
Can I configure the pom.xml
somehow, so that it doesn't create the non-executable JAR file?
At the moment I use <appendAssemblyId>false</appendAssemblyId> so it just overwrites the first file…
Also I get several "… already added, skipping" messages. Can I somehow prevent them?
This is the maven-assembly-plugin definition in my pom.xml
:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>my.main.class</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Best Answer
I got it to work using the maven-jar-plugin and the single goal of maven-assembly-plugin like this
Anyway the most important thing is to tell maven not to generate the default jar using this configuration of the maven-jar-plugin