pom.xml: telling Maven what to do

The pom.xml file that Eclipse generated is a very basic POM. We are going to need more than that for our project. Let's add some information to the pom file, so that Maven knows what to do with our project.

Copy the following contents to your pom.xml file.

<project xmlns="" xmlns:xsi=""
    <name>My Spring MVC Application</name>

If you know Maven, most of this will speak for itself. If you don't know Maven that well, read on.

The groupId, artifactId and version together identify the application. 

I included the packaging tag and set it to "war". This will cause Maven to generate a war file instead of the default jar file.

Also, I included dependencies for spring-context and spring-webmvc, as we'll need these later on to turn this into a Spring MVC application.

The dependency on log4j is obviously needed for logging.

The finalName tag is set to ROOT. This will cause the Maven compiler pluging to create a file called ROOT.war. I prefer ROOT, because I want to  deploy my application as the root application in Tomcat. If you have different preferences you can specify a different name and publish your application in a subdirectory ot the root, BUT, be sure to keep this in mind later when we configure web.xml.

 And finally I included the maven-compiler-plugin to set the target version to Java 1.6.