JavaHow to Use Maven for Project Management in Eclipse

How to Use Maven for Project Management in Eclipse content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Maven is a Java project management tool based on a Project Object Model (POM). It is an open source project that allows project managers and developers to create, build, manage, and test software development projects. This programming tutorial discusses why – and how – you should use Maven as your project management software.

Benefits of Maven as a Project Management Tool

As a developer, you may decide to build your projects from scratch; however, this may be a time consuming and tiring process. Here are some features that Maven possesses that can help you ease project development and better manage your software development process.

Dependency Management

Maven’s Dependency Management feature is one of the biggest reasons why programmers should consider using Maven as your PM tool of choice. If you are developing a big project, the issue of managing your dependencies quickly becomes an issue. Maven has a central repository that allows you to easily download and update dependencies.

Developer Collaboration

Using a project management tool like Maven provides project managers (and their teams) many benefits. Maven provides you with a standard directory structure for a number of projects. This, in turn, ensures easy collaboration between distributed and remote developers, IT support, and stakeholders of your team. Below is the standard Maven directory structure.


Easy Project Setup

Maven provides a project templating tool called Archetype to easily set up projects. Archetypes are sample projects that you can download and use as a reference for modeling your own software development project. Say you would like to develop a RESTful web API using Jersey. You can simply check Maven’s archetype directory for reference setup of the project.

Maven Archetype directory

How to Install Maven

There are a number of ways in which you can install Maven: either through the terminal or from your Eclipse IDE.

It is much easier for developers to interact with Maven using Eclipse. Therefore, this tutorial will focus on this approach. To learn how to install and configure Maven from the terminal, check out our tutorial: Getting Started with Maven.

Before learning how to install Maven on Eclipse, it is important to understand that there are different types of Eclipse code editors. If you are using Eclipse IDE for Enterprise Java and Web Developers, then Maven should already be installed.

If you are using Eclipse IDE for Java Developers (the most likely scenario), then you can check the Eclipse marketplace for the Maven Plugin. You can do so by going to Help > Marketplace and then searching for m2eclipse or following this link.

Maven Eclipse Marketplace
Example of Eclipse Marketplace

How to Create a POM File

First, let’s learn how to create a new Maven project. Click File > New > Maven Project

You will see a dialog box pop-up like the one below:

Maven POM file

Next, let’s choose Create a simple project. After checking this box, click Next. You should have a dialog box similar to the one below:

Maven POM file

The group id (for example, com.developer) specifies the package in which the project will be. The Artifact Id (for example, webapp) is the name of the project directory. Name is the name of the project. After entering these fields, press Finish.

Now, let’s discuss the POM (Project Object Model) file. POM is an XML file that specifies project details such as dependencies, plugins, or build profiles. It determines how Maven builds different components of your project.

The minimum requirements for a POM file are as follows:

  • project: This is the root element of the POM file
  • modelVersion: This is the currently supported POM version. At the time of this writing, version 4.0.0 is the only one supported
  • groupId: This defines the directory ID of your project. By convention, this is usually the reverse of your site’s domain name
  • artifactId: This is the name of project’s directory
  • version: The version of your artifact/project under the given group

Here is the sample POM file that was created from the instructions in this section:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Yours may look different depending on your system settings and when you created the file (for example, if a newer version of Maven exists at that time).

How to Build and Deploy Projects in Maven

Before discussing how you can build your software project, it would be unfair to complete this tutorial without talking about how to use dependencies. To define dependencies in your POM file, use the dependencies tag. In this tag, you can list each dependency that you need using the dependency tag.

Here is an example of the servlet API dependency in Maven:


You may be wondering how to get the values for the groupId or version to use. You can navigate to the POM file for the particular dependency you want from the Maven central repository.

Finally, to build your project, right-click on the project folder from your Eclipse editor. Choose Run as > Maven Build….. In the box for Project goals, enter clean install. This will ensure that all your project dependencies are downloaded. Ensure that you have an active Internet connection while all this is taking place.

Final Thoughts on Maven Dependency Management

Maven is a free software under the Apache Software Foundation. It eases the work of project management by automating some processes as you create, build, test, and deploy your project. If you are working on a large Java project, for example, you should certainly consider using Maven.

Project Management Tools for Developers

While Maven is a great tool for managing software development projects, dependencies, and code repositories, as well as for allowing collaboration with other programmers, it may not suit your exact needs as a true project management tool. If you find yourself looking for project management software with features like advanced reporting, issue and bug tracking, Kanban boards, Gantt charts, and file sharing, we suggest you take a look at our list of the Top Project Management Software and Tools for Developers for other options.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories