Download and Install Maven 2.2.1 or Later

Download and install Maven 2.2.1 or later from this site:

If you are using Ubuntu, you may install Maven with the following command: +---+ sudo apt-get install maven2 +---+

Maven Setup

Create a directory in your home directory called .m2 with a single file inside called settings.xml . This is what an example settings.xml looks like:








                <name>ibiblio Mirror of




All sections are optional. However, depending on your circumstances, you may wish to use one or more of these settings. The "localRepository" element names a location separate from the default home directory for the Maven2 repository. This may be beneficial if you have limited space on your home directory, as this repository directory can grow quite large. The "proxies" element should only be used for those developers who must access the internet via a proxy. The "mirrors" section is useful to have in case the primary central Maven2 server is offline for some reason.

Environment Variables and Settings for Maven

Set up the environment variable M2_HOME to point to your maven installation directory, and then ensure that both $M2_HOME/bin and $JAVA_HOME/bin are present in your PATH. Also set M2_REPO, which is the location of your Maven2 repository. Not only is it recommended by Maven, it is also a variable used by this project later on.

Test Maven (Part One)

Test that you've installed maven correctly by runningmvn --version . You should see something similar (but not necessarily identical) to the following:

                $ mvn --version
                Maven version: 2.2.1
                Java version: 1.6.0_24
                Java home: /usr/lib/jvm/java-6-sun-
                Default locale: en_GB, platform encoding: UTF-8
                OS name: "linux" version: "2.6.38-8-generic-pae" arch: "i386" Family: "unix"

Test Maven (Part Two)

Check that Maven2 is working properly by creating a temporary, empty project with the following command:

                mvn archetype:create -DgroupId=testapp -DartifactId=testapp

Check for the BUILD SUCCESSFUL message and, once you have received this message, please delete the created testapp folder.