Home > Tutorial > maven > Create New Maven Project

Create New Maven Project

As a current Java developer, I like to develop my projects a certain way. My development environment consists of Eclipse IDE and Maven. I am sure you have heard of Maven, but maybe don’t fully understand what it is and how it can be a big benefit your Java development process. Let’s go through with a quick explanation followed by how to create a new maven project.

What is Maven

Maven, part of Apache, is a Java based software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information. Basically all of your project details go into the pom.xml file. You will see this later.

Needed Software For Maven Project

Before we can create a new Maven project, there are some prerequisite software that needs to be in place in your development environment. My development environment is a windows 10 laptop that has Eclipse IDE running Java 1.8 as well as the Maven software for Eclipse installed.

Create New Maven Project

So let’s go through each step to create a brand new maven project in Eclipse from scratch.


Step 1 – File » New » Other » Maven » Maven Project

Starting in Eclipse navigate to File New Other Maven and finally select Maven Project. Click the Next button to proceed.


Step 2 – Project Name & Location

The next screen has three check boxes. Leave the “Create a Simple Project” unchecked. Leave “Add project to working set” unchecked as well. The “Use default workspace” is checked by default. I left mine that way because I am using the default workspace location I setup when I originally installed Eclipse. You can change it to a new location if you like. Click the Next button to proceed.


Step 3 – Select an Archetype

The next step is asking to select an Archetype. The new project wizard will select maven-archetype-quickstart by default and I did not choose to change to a different Archetype. Click the Next button to proceed.


Step 4 – Specify Archetype Parameters

This screen is asking you to enter the Group Id and the Artifact Id. The Artifact Id will end up being the name of the resulting jar without version info attached to the end. The Group Id will end up being the identification of your project. This follows package naming rules. Click the Finish button to proceed.


Step 5 – New Maven Project Created

If you go into Eclipse Package Explorer (left side pane), you can now expand the file structure of your new Maven project. You can now start development on your new Java project that is run by Maven.


Default POM File

You will see a default pom.xml file has been created in your maven project. You will see it as the last item in the project when looking at the Eclipse project explorer. You can see where the Group Id and Artifact Id end up in the pom.xml file based on Step 4 above.



Prerequisites:

  1. Java JRE 1.7 or 1.8 (My Version: 1.8)
  2. Eclipse IDE (My Version: Oxygen.2 Release 4.7.2)
  3. Maven Integration For Eclipse

References:

Smedley
Posted by

Smedley

Smedley has been programming in Java for about twenty years. He enjoys sharing code samples to other fellow Java coders.

You may also like...

(1) Comment

  1. Bill

    Good job on the tutorial.

Leave a Reply

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

Copyright © 2018 JavaCodeDepot