fullstackcrash fullstackcrash - 1 month ago 26
Java Question

Maven: How to rename the war file for the project?

I have a project

bird
with following components in
pom.xml


<groupId>com.myorg</groupId>
<artifactId>bird</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>bird</name>

<modules>
<module>persistence</module>
<module>business</module>
<module>service</module>
<module>web</module>
</modules>


and the web module as

<parent>
<artifactId>bird</artifactId>
<groupId>com.myorg</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>web</artifactId>
<packaging>war</packaging>


web module creates the war file named
web-1.0-SNAPSHOT.war


How can I, using maven rename this to
bird.war
?

Answer

You can use the following in the web module that produces the war:

<build>
  <finalName>bird</finalName>
 . . .
</build>

This leads to a file called bird.war to be created when goal "war:war" is used.

Comments