如何使用 Maven 将实现版本值添加到 jar 清单? [英] How do I add an Implementation-Version value to a jar manifest using Maven?

查看:27
本文介绍了如何使用 Maven 将实现版本值添加到 jar 清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 jar 文件中的清单中添加一个 Implementation-Version 行,以反映 POM 版本号.我一生都无法弄清楚如何使用 jar 插件来做到这一点.

I'd like to add an Implementation-Version line to a manifest in my jar file that reflects the POM version number. I can't for the life of me work out how to do this using the jar plugin.

这可能吗?

推荐答案

您将使用 Maven Archiver:

You would use the Maven Archiver:

<plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          </manifest>
        </archive>
      </configuration>
    </plugin>
  </plugins>

这会将以下内容添加到清单文件中:

This will add the following to the manifest file:

Implementation-Title: ${pom.name}
Implementation-Version: ${pom.version}
Implementation-Vendor-Id: ${pom.groupId}
Implementation-Vendor: ${pom.organization.name}

这篇关于如何使用 Maven 将实现版本值添加到 jar 清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆