![](/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.