maven-jar-plugin:3.1.3 未能执行目标
maven-jar-plugin:3.1.3 failed to execute goal
项目需要将maven-jar-plugin从2.3.x版本更新到当前最新版本(3.1.2),更新
后执行goal失败
更新前的pom文件如下图
<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>
一旦更改为 <version>3.1.2</version>
和 运行 maven 清理并安装,它会打印出以下错误
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.
问题:
如何使用分类器将补充工件附加到项目而不是替换它们?
更多信息
项目是一个 java 项目,intelliJ IDEA 是 IDE
在 配置 部分添加一个 分类器 将使其工作
<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.
报价可以找到here
项目需要将maven-jar-plugin从2.3.x版本更新到当前最新版本(3.1.2),更新
后执行goal失败更新前的pom文件如下图
<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>
一旦更改为 <version>3.1.2</version>
和 运行 maven 清理并安装,它会打印出以下错误
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.
问题:
如何使用分类器将补充工件附加到项目而不是替换它们?
更多信息
项目是一个 java 项目,intelliJ IDEA 是 IDE
在 配置 部分添加一个 分类器 将使其工作
<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.
报价可以找到here