Part 2: Creating Maven Projects

The defining piece of a Maven project is its definition in pom.xml. This file provides Maven with all the information it needs to build your project.

Maven uses a small set of values to identify projects. You will need these for every Maven project you create and every Plugin and Dependency you use will have them as well.

The 3 required properties are:

  • groupId: This represents the group this project belongs to. This is generally a reverse domain name like most Java packages use. This value will likely not change over the course of your project's development. Ex: com.example
  • aritfactId: This is the name of your project. This needs to be unique within the groupId you provided. This value will also not change over time. Ex: helloworld
  • version: Represents the version of your application and usually done in an X.Y.Z type format. Version will change over time if your project goes through several releases and updates. You will also often see the word SNAPSHOT in the version property. This is explained below.

Additionally, you must define the version number of Maven's Project Object Model that you want to use. This lets Maven know how to parse your pom.xml. For our examples this property, modelVersion, will always be 4.0.0.

Wether creating a project manually or automatically you will need to decide on a value for these properties. Here's what we'll be using to start:

  • groupId = com.example
  • artifactId = hello
  • version = 1.0.0-SNAPSHOT
  • modelVersion = 4.0.0

Snapshot versus Release