I have a multi-module Maven project and in one module I want to create two artifacts during the build:
- The main artifact which is a jar library that some of the other modules will depend on.
- An executable jar file that executes some helper functions. No other modules depends on this and its only intended for the user to run it manually in certain situations.
Here is the code that I use to configure the maven-assembly-plugin
plugin:
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>dist-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>bso</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>helper-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>HelperMain<mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
I am setting appendAssemblyId
to false
because otherwise -jar-with-dependencies
will be appended to the final name and I do not see the need for it. Omitting it gives a cleaner and easier to use file name.
When I run mvn integration-test
then I receive the following warnings:
[WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing. Instead of attaching the assembly file: [...]/target/helper-5.0.0-SNAPSHOT.jar, it will become the file for main project artifact.
NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!
[WARNING] Replacing pre-existing project main-artifact file: [...]/target/my.module-5.0.0-SNAPSHOT.jar with assembly file: [...]/target/helper-5.0.0-SNAPSHOT.jar
There are two things which irritate me:
Despite the fact that the warning claims it will replace my.module-5.0.0-SNAPSHOT.jar with helper-5.0.0-SNAPSHOT.jar it does not actually do so and when the build has finished both files still have different sizes.
Why does the warning about replacing the artifact appear at all?
It seems that
classifier
is deprecated why does the warning ask me to use it?