Programming
How Maven Builds a WAR File
Introduction
When dealing with a Java Web applications, the completed application is commonly delivered as a WAR file. The Maven build system can easily be set up to create WAR files. In this post we take an in-depth look at how Maven goes from a source project to the final WAR product.
Used software: Apache Maven 3.0.4.
The structure of a WAR file looks like this (source):
Example Project
Let’s look at a very simple Mavenized Web application project in a directory named myprojectname. The contents of this folder are:
The pom.xml file looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mygroup.com</groupId> <artifactId>myprojectname</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>myprojectname Maven Webapp</name> <url>http://maven.apache.org
…


