![](/img/trans.png)
[英]How to build maven project both Snapshot and Release build simultaneously
[英]In maven, how to name war file different in release than in snapshot build
我正在使用maven-war插件。 我也看过了maven-versions插件。 在这两种情况下,我都看不到如何为快照版本赋予与发布版本不同的名称。
我看过使用配置文件的示例,但是文档似乎表明在pom.xml中使用配置文件不是一个好主意。
应该怎么做?
您可以通过warName
属性控制最终战争文件的名称
试试下面
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
<classifier>${envClassifier}</classifier>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>snapshot</id>
<properties>
<envClassifier>snapshot</envClassifier>
</properties>
</profile>
<profile>
<id>release</id>
<properties>
<envClassifier>release</envClassifier>
</properties>
</profile>
</profiles>
现在,运行命令mvn clean install -Psnapshot
或mvn clean install -Prelease
以获得所需的工件。 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.