I have a project bird
with the 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 pom.xml
<parent> <artifactId>bird</artifactId> <groupId>com.myorg</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>web</artifactId> <packaging>war</packaging>
The web module creates a war file named web-1.0-SNAPSHOT.war
How can I configure maven to build it as bird.war
?
You can rename the WAR file if you are using a WAR file for deployment, and you want to use "Workplace XT" or a custom name for the context root of the application. The context root is part of the URI that end users type to access Workplace XT.
Maven looks for the pom. xml file, so you should rename it that for it to work. You could use another file name using the -f option. mvn -f parent-pom.
Using the mvn:war:exploded command, we can generate the exploded WAR as a directory inside the target directory. This is a normal directory, and all the files inside the WAR file are contained inside the exploded WAR directory.
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.
You need to configure the war plugin:
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <warName>bird.war</warName> </configuration> </plugin> </plugins> </build> ... </project>
More info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With