Creating a Simple Maven Project

Maven

If not already done so, obtain a local install of Maven for your development environment. For instructions on how to install and build maven please refer to the documentation posted at Requirements. If all goes well, you should be able to open a command prompt window, and at the command prompt, type 'mvn -version'.

mvn -version

You should see a message similar to below, displaying the version of Maven and Java.

Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
Java version: 1.6.0_22
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.6" arch: "x86_64" Family: "mac"

Depending on you comfort level there may be more Maven configuration tricks that you may want to perform, such as customizing your settings.xml file. Look at the Additional References section below for more tutorials on Maven configurations that you may find helpful. 

Creating the Maven Project in Eclipse using archetypes

There are probably various ways to create a maven project but I found this one very simple at creating a basic maven structured project using archetypes.

Prerequisite

You will need to install the Eclipse IDE Maven plugin found at the Eclipse Marketplace

Maven Integration Eclipse Plugin

Step 1. Create a New Maven Project
  1. Click 'File' -> 'New' -> 'Other' -> 'Maven Project' and then click 'Next'.

Step 2. Select project name and location.  

Use the default Workspace location or specify the location if necessary.

Step 3. Select an archetype

Select the maven-archetype-quickstart archetype from the list. It's a simple Maven web structure that will help get you started.

Step 4. Enter the Group id and Artifact Id

Enter the Group Id and Artifact Id and click 'Finish'

Step 5. Your New Maven Project

Below is what your sample structure looks like after you perform all the steps. This should help as a starting point.

Having problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org