The project need to update the maven-jar-plugin from 2.3.x version to the current newest version (3.1.2), it failed to execute goal after updating
The pom file before updating is shown below
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>src/main/resources/templates/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
<Bundle-Name>${project.groupId} ${project.artifactId} package</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
Once change to <version>3.1.2</version>
and run maven clean and install, it print out the following error
Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default) on project xxx: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.
Question:
How can I use a classifier to attach supplemental artifacts to the project instead of replacing them?
More Info
project is a java project and intelliJ IDEA is the IDE
Add a classifier within configuration section would make it work
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<classifier>client</classifier>
<archive>
<manifestFile>src/main/resources/templates/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
<Bundle-Name>${project.groupId} ${project.artifactId} package</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
The classifier distinguishes artifacts that were built from the same POM but differ in content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number. As a motivation for this element, consider for example a project that offers an artifact targeting JRE 1.5 but at the same time also an artifact that still supports JRE 1.4. The first artifact could be equipped with the classifier jdk15 and the second one with jdk14 such that clients can choose which one to use.
Another common use case for classifiers is to attach secondary artifacts to the project's main artifact. If you browse the Maven central repository, you will notice that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files.
The quotation can be found here