rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

Create a new Java project using maven

Creating new Java project happens somehow often, but remember to add the pom.xml file is always something I forget. Of course, after creating this I will remember but in case you don't remember how, or you do not know how here's two simple ways on how to create a Java project using maven:

The UI method

First, let's start by creating a new Project:

Name your project and location:

This creates the basic structure:

Adding Maven / pom.xml

Now, let's make this project a Maven project. Right-click on the Project name in the "breadcrumb" section, then select "Add Framework Support..."

Select, Maven and click OK

Now we have a pom file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""


This pom file needs some love!

Simply change the "groupId", "artifactId" and "version" tags, example:


At this point now you can create new files in the src/main folder and create some test that goes with it.

The Command line method

Another way to (very) easily build a maven project is using the command line tool.

mvn archetype:generate \ \
    -DartifactId=BookOfZeusApp \
    -DarchetypeArtifactId=maven-archetype-quickstart \

The "archetypeArtifactId" means what archetype to use to create the initial structure of the project

The interactiveMode means:
true if Maven should attempt to interact with the user for input, false if not. Defaults to true

This will create everything you need, including a sample script!


Notes: You might want to change the jUnit version from the pom.xml file.