在maven中,如何命名发布中与快照构建中不同的war文件



我正在使用maven war插件。我也看过maven版本的插件。在这两种情况下,我都看不到如何为快照构建赋予与发布构建不同的名称。

我看到过使用概要文件的例子,但文档似乎表明在pom.xml中使用概要文件不是一个好主意。

应该如何做到这一点?

尝试以下

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webXml>srcmainwebappWEB-INFweb.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 -Psnapshotmvn clean install -Prelease来获得所需的工件。希望这能帮助

您可以通过warName属性控制最终战争文件名

最新更新