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...

  1. Run the following command from the command prompt:
    mvn archetype:generate –DinteractiveMode=false  -DgroupId=com.packt.cookbook -DartifactId=simple-webapp -DarchetypeArtifactId=maven-archetype-webapp 
    
  2. Observe the output:
    How to do it...
  3. Open the created pom file:
    <modelVersion>4.0.0</modelVersion> <groupId>com.packt.cookbook</groupId> ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.