[英]In maven, how to name war file different in release than in snapshot build
I'm using the maven-war plugin. 我正在使用maven-war插件。 I've also looked at the maven-versions plugin.
我也看过了maven-versions插件。 In neither case do I see how to give a different name to a snapshot build than a release build.
在这两种情况下,我都看不到如何为快照版本赋予与发布版本不同的名称。
I've seen examples using profiles but the docs seem to indicate that the use of profiles in the pom.xml is not a good idea. 我看过使用配置文件的示例,但是文档似乎表明在pom.xml中使用配置文件不是一个好主意。
How should this be done? 应该怎么做?
您可以通过warName
属性控制最终战争文件的名称
Try the below 试试下面
<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>
Now, run command mvn clean install -Psnapshot
Or mvn clean install -Prelease
to get your desired artifacts. 现在,运行命令
mvn clean install -Psnapshot
或mvn clean install -Prelease
以获得所需的工件。 Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.