How do I add an Implementation-Version value to a jar manifest using Maven?

前端 未结 1 1577
挽巷
挽巷 2020-12-29 02:32

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

相关标签:
1条回答
  • 2020-12-29 03:12

    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}
    
    0 讨论(0)
提交回复
热议问题