簡體   English   中英

在Maven中,如何在發行版中命名與在快照構建中不同的war文件

[英]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 -Psnapshotmvn clean install -Prelease以獲得所需的工件。 希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM