Brett Porter

The Ten Minute Test - Creating a Maven Build

Ok, what we'll do here is create and build a simple project. It will be a utility library. The only class we'll add is one to take an input string and add ### on either side. Useful, huh?

As part of the slightly more interesting build process, we will:

Now before you start that watch ticking for 10 minutes, you are going to need to download Maven. If you are intending to do this offline later, you should make sure to pick up the "seed repository" and install it according to the instructions.

You will also need to install Maven. This is just a few short commands (or clicks if you are on Windows). If maven -v gives you something useful, then you are ready to go!

Before we start: Terms used

You will hopefully find these descriptions useful as you take part in the ten minute test:

TermDefinition
Goal For those familiar with Ant, this is like a target. It is something you wish to do, which may also perform other goals. An example might be jar, site, or war:webapp.
Project Descriptor This is the project.xml file, and is currently the only way to define the Project Object Model (POM). This describes your project to Maven.

Step 1: Create a project descriptor

It all starts with project.xml. While you can run Maven without it, it will not know anything about your project and can't do more than run project-independant

Different people have different preferences for how they create their project descriptor. Some will copy from an existing project and edit, some will run maven genapp and accept the defaults to get a skeleton project, and some will hand-edit it from scratch. In the near future, tools will be available to graphically edit the project descriptor.

More to come...