Building a WAR project
So far, we have been building projects that generate a JAR artifact. When it comes to web applications, we typically create WAR artifacts. Maven supports the building of WAR artifacts. The packaging type .war
indicates to Maven that it is a WAR artifact. Maven automatically invokes the corresponding lifecycle bindings.
How to do it...
- Run the following command from the command prompt:
mvn archetype:generate –DinteractiveMode=false -DgroupId=com.packt.cookbook -DartifactId=simple-webapp -DarchetypeArtifactId=maven-archetype-webapp
- Observe the output:
- Open the created
pom
file:<modelVersion>4.0.0</modelVersion> <groupId>com.packt.cookbook</groupId> <artifactId>simple-webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>simple-webapp Maven Webapp</name> <url>http://maven.apache.org</url> <build> <finalName>simple-webapp...