Book Image

Apache Maven Cookbook

By : Raghuram Bharathan
Book Image

Apache Maven Cookbook

By: Raghuram Bharathan

Overview of this book

If you are a Java developer or a manager who has experience with Apache Maven and want to extend your knowledge, then this is the ideal book for you. Apache Maven Cookbook is for those who want to learn how Apache Maven can be used for build automation. It is also meant for those familiar with Apache Maven, but want to understand the finer nuances of Maven and solve specific problems.
Table of Contents (13 chapters)
12
Index

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:

  3. 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</finalName...