Pages

Sunday, June 17, 2012

How to create a simple Maven 2 web project with Eclipse


Here we will have look at how to create a Maven 2 Web application using "Eclipse IDE for Java EE Developers"

If you don't have the IDE, it can be downloaded from here for free.

Maven is a tool that can be used for building and managing any Java-based project. Here we will consider only about how to create a Web Application.

Below are the steps to create the web application,

Step 1: Right click on project explorer and select New-->Other


Step 2: Type "maven" in the text box available, select "Maven 2 Project Creation Wizard", and click "Next"


If you don't have "Maven 2 Project" here, it means you will need to add Maven plugin to eclipse. Find here how to do it:-http://www.dotkam.com/2008/02/24/install-maven-plugin-for-eclipse/

Step 3: Then, in the new window, type an appropriate name for the project and click "Next"


Step 4: In the "Maven Archetypes" type "web" and select "maven-archetype-webapp-RELEASE" from the list, and click next


Step 5: In the "Maven Project Information" window, change the names if you want, else leave it as it is, and then click finish


If you followed the steps correctly, a project will be created in your workspace with the following structure


The pom file will be like below,


Now you can add any dependencies to the POM file and continue with your project. Happy Coding!