How do I create a web application project using maven?
Author: Deron Eriksson
Description: This tutorial describes how to create a web application project using maven.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)


Page:    1 2 >

In a previous tutorial, we saw how we could use the mavenSW archetype:create goal to create a basic maven project. We can also use the archetype:create goal to create a basic web application project by using with a "maven-archetype-webapp" archetype.

mvn archetype:create 
 -DarchetypeGroupId=org.apache.maven.archetypes 
 -DarchetypeArtifactId=maven-archetype-webapp 
 -DarchetypeVersion=1.0 
 -DgroupId=com.maventest 
 -DartifactId=mywebtest 
 -Dversion=1.0-SNAPSHOT

The above maven command states to use the "archetype:create" goal to create a basic web application (war) project using the "maven-archetype-webapp" archetype. The project is called "mywebtest", it belongs to the group "com.maventest", and its version number is "1.0-SNAPSHOT".

I opened a command prompt window and typed the above maven command.

creating web application with maven

The execution of the maven command is shown here.

Execution of archetype:create command

(Continued on page 2)

Page:    1 2 >