Maven Web Application Eclipse Example


In this article we will see how to use Maven to setup web application project in Eclipse.

  • I am using Eclipse as the IDE, version Luna 4.4.1.
  • Apache Maven is a software project management and comprehension tool. It manages the project build using the project object model (POM) XML.

Download Maven and Install Maven-Eclipse Plugin

    1. Download Maven.
    2. If you haven’t used Maven before in Eclipse then you may also need to install theMaven-Eclipse plugin.
    3. You need to click on the Help->Install New Software. Enter in ‘Work with’ an click on Add.
    4. Select Maven plugin. Click on Next and then Finish.
Maven Eclipse Plugin

Maven Eclipse Plugin

Now that we have installed Maven and Eclipse-Maven plugin, we will be able to create Maven Projects. Let’s create one.


Click on File->New->Other

Eclipse Other Projects

Eclipse Other Projects

Click on ‘Maven’->’Maven Project’

Maven Project

Maven Project

We now need to select archetype so leave ‘Create Simple Project’ unchecked and move ahead.

Maven Project Main Screen

Maven Project Main Screen

Now what is an archetype?
Archetype is a Maven project templating 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’. This will create sample Maven Webapp project. Once selected, click on Next.

Maven Archetype Web-app

Maven Archetype Web-app

Now that we have created a template, enter your own ArticfactId and GroupId.

Enter ArtifactId and GroupId

Enter ArtifactId and GroupId

In order to just run the sample app, we still need servlet api. Let’s add javax.servlet-api to our pom.xml, version 3.1.0.

<project xmlns="" xmlns:xsi=""
	<name>webAppExample Maven Webapp</name>

If you don’t see Simply create a java directory under main (i.e. src/main/java) and right-click on your project and select Maven > Update Project Configuration.

The project structure should look like below:


Run the web application

Now let’s run our webapp. It should open up a browser and display ‘Hello World’ page.

Click on 'Run on Server'

Click on ‘Run on Server’

We will be using tomcat as our server.

If you have configure more than one tomcat or not yet configure, this is time to do and select one.



Select Tomcat Server

Select Tomcat Server

Once tomcat is selected and clicked on Finish, our web application will open up.

Webapp 'Hello World' page

Webapp ‘Hello World’ page

Download the Eclipse Project

This was an example about creating web application project in Eclipse using Maven. You can download the source code here:


Comments are closed.