【发布时间】:2012-01-03 03:52:24
【问题描述】:
我正在尝试为 jar-packaged 工件和 test-jar-packaged 创建不同的 MANIFEST.MF 文件。 maven-jar-plugin 用于在MANIFEST.MF 中添加其他内容 - 到目前为止效果很好。但是,如果我想为 testproject 的 MANIFEST.MF 选择不同的模板文件,Maven 只对两个工件使用第二个引用的模板......
如何让 Maven 使用 PROD-MANIFEST.MF-template 进行正常的 jar 打包,使用 TEST-MANIFEST.MF-template 进行 test-jar 打包?
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>test-manifest-mf</id>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestFile>foo/TEST-MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-manifest-mf</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestFile>foo/PROD-MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
【问题讨论】:
标签: java maven package manifest.mf maven-jar-plugin