我想在我的 jar 文件中的清单中添加一个 Implementation-Version 行,以反映 POM 版本号。我一生都无法弄清楚如何使用 jar 插件来做到这一点。
这可能吗?
我想在我的 jar 文件中的清单中添加一个 Implementation-Version 行,以反映 POM 版本号。我一生都无法弄清楚如何使用 jar 插件来做到这一点。
这可能吗?
您将使用 Maven 存档器:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
这会将以下内容添加到清单文件中:
Implementation-Title: ${pom.name}
Implementation-Version: ${pom.version}
Implementation-Vendor-Id: ${pom.groupId}
Implementation-Vendor: ${pom.organization.name}