Note: This is a work in progress, please see the index page for more details.
The build system for this project will be a combination of Maven 2.0.9 and Ant 1.7.0 so you will want to download and install both if you don’t already have them installed. They are both pretty straight-forward, just follow their installation instructions and everything should work out of the box.
I also recommend installing Maven and Ant support for your IDE. Eclipse has built-in support for Ant, and there is a good plug-in for Maven, called M2 Eclipse.
Now we can setup the starting point for our project. Run the maven archetype goal to generate the project template code for a webapp project:
mvn archetype:create
-DgroupId=stehno
-DartifactId=hello-world-webapp
-DarchetypeArtifactId=maven-archetype-webapp
From this template code, create a project in your IDE. The Eclipse M2 plug-in also allows you to run the archetype goal directly as a project creation wizard; either method should be fine.
Take a look at the generated pom.xml file. This is the project file used by maven to manage the project and its dependencies. You will want to edit this file to look something like the following:
<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>stehno</groupId>
<artifactId>hello-world-webapp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Hello World</name>
<build>
<finalName>helloworld</finalName>
</build>
</project>
This project will be used to store all of the web config information as well as the view templates and spring configuration files. It’s empty for the most part but let’s go ahead and generate the artifact for this project anyway, the helloworld.war file. Run the maven package command in the project root directory as follows:
mvn package
If it’s your first time running maven you will have to wait for a bit while maven downloads all of its dependancies and gets everything setup, then you should see a SUCCESS message. You can then look into the target/ directory to find the war file.
With your build and development environments stubbed out, now would be a good time to delve into source code control.



