Pra*_*ram 6 pom.xml maven-3 maven
我正在尝试在Maven在该META-INF/maven/${groupId}/${artifactId}位置生成的pom.properties文件中添加自定义值
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<build>${BUILD_TAG}</build>
</manifestEntries>
<addMavenDescriptor>true</addMavenDescriptor>
<pomPropertiesFile>${project.build.directory}\interface.properties</pomPropertiesFile>
</archive>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
interface.properties文件的内容是
# Build Properties
buildId=746
Run Code Online (Sandbox Code Playgroud)
使用文档我将pomPropertiesFile元素指向外部属性,但生成的pom.properties文件在运行后仍然具有默认内容mvn install
这个pomPropertiesFile元素的正确用法是什么?
编辑
我相信问题在于org.apache.maven.archiver.PomPropertiesUtil.如果查看源中的方法sameContents,如果外部文件中的属性与默认值相同则返回true,如果不同则返回false.如果结果为false,则忽略外部文件的内容.sameContents
果然,这已被记录为一个错误
我认为你需要在 src/main/resources/META-INF/${groupId}/${artifactId}/interface.properties 下放置一个文件,并让 maven 执行过滤工作(配置过滤)。该文件将自动复制到 target/META-INF/maven/${groupId}/${artifactId}/ 位置。
| 归档时间: |
|
| 查看次数: |
7543 次 |
| 最近记录: |