[英]Putting version information in manifest file into JAR using Maven
I am trying to find a way of putting version information in manifest file into JAR using Maven? 我正在尝试找到一种使用Maven将清单文件中的版本信息放入JAR的方法?
For WAR files I use the following in my POM.XML 对于WAR文件,我在POM.XML中使用以下内容
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
and then I run " mv clean package " 然后我运行“ mv clean package ”
How would you do this for a JAR.. Can you please give me details information on the changes and the commands... thanks 您将如何针对JAR进行此操作。.能否请您提供有关更改和命令的详细信息...谢谢
You can use maven-jar-plugin (the configuration is nearly the same as maven-war-plugin) 您可以使用maven-jar-plugin(配置与maven-war-plugin几乎相同)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<key>value</key>
</manifestEntries>
</archive>
</configuration>
...
</plugin>
Here the documentation of the plugin: https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html 这里是插件的文档: https : //maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html
And all options: http://maven.apache.org/shared/maven-archiver/index.html 以及所有选项: http : //maven.apache.org/shared/maven-archiver/index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.