【发布时间】:2010-10-29 15:08:30
【问题描述】:
我想在我的 jar 文件中的清单中添加一个 Implementation-Version 行,以反映 POM 版本号。我一辈子都想不出如何使用 jar 插件来做到这一点。
这可能吗?
【问题讨论】:
标签: java maven-2 build-process jar manifest
我想在我的 jar 文件中的清单中添加一个 Implementation-Version 行,以反映 POM 版本号。我一辈子都想不出如何使用 jar 插件来做到这一点。
这可能吗?
【问题讨论】:
标签: java maven-2 build-process jar manifest
您将使用 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}
【讨论】:
<artifactId>maven-ear-plugin</artifactId>
<maven.compiler.target>1.8</maven.compiler.target>