在Maven中-如何根据使用中的配置文件名称重命名输出.war文件 [英] In maven - how to rename the output .war file based on the name of the profile in use
本文介绍了在Maven中-如何根据使用中的配置文件名称重命名输出.war文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的pom.xml中有用于我们应用程序的三个配置文件...
I have three profiles in my pom.xml for our application...
- dev(供开发人员使用)
- qa(用于我们内部的qa服务器)
- 产品(生产).
运行Maven构建文件时,所有三个配置文件都会输出具有相同名称的war文件.我想输出$profilename-somearbitraryname.war
When we run our maven build all three profiles ouput a war file with the same name. I would like to output $profilename-somearbitraryname.war
有什么想法吗?
推荐答案
您已经正确回答了自己:
You've answered yourself correctly:
<profiles>
<profile>
<id>dev</id>
<properties>
<rp.build.warname>dev</rp.build.warname>
</properties>
</profile>
<profile>
<id>qa</id>
<properties>
<rp.build.warname>qa</rp.build.warname>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<rp.build.warname>prod</rp.build.warname>
</properties>
</profile>
</profiles>
但是有一种更简单的方法来重新定义WAR名称:
but there is a simpler way to redefine WAR name:
<build>
<finalName>${rp.build.warname}-somearbitraryname</finalName>
<!-- ... -->
</build>
不需要maven-war-plugin
.
这篇关于在Maven中-如何根据使用中的配置文件名称重命名输出.war文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文