Create your first Maven Project with eclipse

In this tutorial we are going to see how to create a simple maven project in eclipse.

1. Download Maven integration plugin

Download the maven integration plugin from eclipse marketplace. The plugin makes it easier to create and work with maven projects in eclipse. In the below picture, you can selected the one which shows installed.

2. Select File > New > Other…

In eclipse IDE select File > New > Other… , this will bring the wizard for project creation. You can also use shortcut key Ctrl+N

3. Select Maven project in wizard

4. Choose Create a simple project and press Next

A basic, Maven-enabled Java project will be created. To use more advanced Maven project setup features, you can leave this option unchecked

5. Configure Maven Project

  •   groupId: This is generally unique amongst an organization or a project. We name it to com.programtalk
  •  artifactId: The artifactId is generally the name that the project is known by. We name it to myFirstMavenProject
  • version: version of an artifact. We give the version 0.0.1-SNAPSHOT
  • packaging: That is the project’s artifact type. jar, pom or war. We will set it as war

Since we are creating a standalone project, so we are not providing any Parent Project details. Click Finish

6. Maven Project structure.

The maven project is created. And you will that there are source folders created. Let us see all the folders :

  • /src/main/java: In this folder we will create the java source files
  • /src/main/resources: In this folder, you can keep the resource files, like properties files
  • /src/test/java: In case you want unit tests, you can create your unit tests here in this folder
  • /src/test/resources: In case your tests are using some properties files or may be some files, you can keep them here.


7. Understanding pom.xml

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project.In the pom.xml, you can define the dependencies of the project, like you may need a dependency to junit in case you want to create a test. Here is the pom.xml of our project. Note: I have selected pom.xml tab.


So you have a new maven project where you can create you java source files and add your own dependencies.

Like this post? Don’t forget to share it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.