This is simple article, that helps to setup and run web application project in Eclipse with Maven.
Apache Maven is a software project management and comprehension tool. It manages the project
build using the project object model (POM) XML.
Tools used :
1) eclipse version Luna 4.4.1.
2) Maven 3.3.3
Steps to be followed :
1) Maven Installation, (This is one time task).
2) Adding Maven-eclipse plugin to your eclipse IDE (This is one time task).
3) Creating maven web application project in eclipse.
4) Run web application on server.
1) Maven Installation :
You can download latest maven version from Maven
Once download is completed, extract the file (Suppose I extracted to C:\Venkat_06012014\Blog\maven\apache-maven-3.3.3\)
Add maven bin to path variable value,
2) Adding Maven-eclipse plugin to your eclipse IDE :
(a) Go to Help -> Install New Software in eclipse and enter http://download.eclipse.org/technology/m2e/releases
in Work with: an click on Add.
(c) Check whether required software’s are installed or not, then click on Next button.
Now maven plugin is installed in eclipse, we can create maven project with eclipse.
3) Creating maven web application project in eclipse :
(a) Go to File -> New -> Others in eclipse.
(b) Select Maven -> Maven Project.
Click on Next button.
(c) Now, we need to Select an Archetype,
What is an archetype?
Archetype is a Maven project template toolkit which means we can select one of its template it will create a
sample project for us. In our case, we want a web-app so we will enter org.apache.maven.archetypes in filter and
then select row with Artifact-id as maven-archetype-webapp.
Select All Catalogs value in Catalog drop down and type “org.apache.maven.archetypes” value
in Filter text box and press enter.
Then list of maven archetype will be displayed and select “maven-archetype-webapp”.
Click on Next button.
(d) Now we have to create a template, enter ArtifactId and GroupId.
4) Run web application on server :
(a) To run this web application, we need javax.servlet-api.jar file. We can mentioned this jar as dependency,
so that this can be downloaded by maven, open pom.xml file add sevlet-api dependency.
javax.servlet javax.servlet-api 3.1.0
(b) Right-click on your project and select Maven > Update Project Configuration.
(c) Right-click on project and Run As -> Run On Server,
How to Add new server to eclipse :
Go to server tab, right click New -> Server,
Click on Finish button.
*** Venkat – Happy leaning ****