35

JAR ファイルのマニフェストに、POM バージョン番号を反映する Implementation-Version 行を追加したいと考えています。私は一生、jar プラグインを使用してこれを行う方法を考え出すことはできません。

これは可能ですか?

4

1 に答える 1

56

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}
于 2009-05-28T16:12:22.620 に答える