Installing Maven

You must first download Maven (please refer to the documentation). This document will describe how to install Maven using one of two flavours of install archives.

The downloaded install archive contains everything required to run Maven on your system. The install archive has a single top-level directory named maven-VERSION, where VERSION is the version downloaded (eg. 1.0). This directory contains all the Maven related files beneath that. You can now unpack the install archive.

Before you begin using Maven you will need to define the MAVEN_HOME environment variable which is the directory where you just unpacked the Maven install archive. (If you are using the Windows Installer this variable will be set for you). You will also need to add MAVEN_HOME/bin to your path so that you can run the scripts provided with Maven. This works in exactly the same way that Ant works.

You will also need to define the JAVA_HOME environment variable. If you are using Mac OS X, Maven will attempt to guess the location of the JDK. This variable should be the directory where a Java Development Kit is installed, i.e. the directory that contains the bin, demo, jre and lib directories

Note: you can safely skip the following step if you have any problems. If you do skip it, Maven will download the dependencies instead of copying them from the lib directory.

Next, you should create your local repository by running one of the following commands:

Note: This step is optional, but will save downloading several JARs a second time. If %HOME% is not set on your Windows system, you can use %HOMEDRIVE%%HOMEPATH%.

If you have downloaded the seed repository, you should extract it under the repository directory created in the step above (eg $HOME/.maven/repository). This will allow you to run Maven offline and successfully run the jar, site and related goals.

Next, verify that your MAVEN_HOME environment variable points to the correct location. In the top-level directory of MAVEN_HOME, you should see the following structure:

If the above directory structure is present you have everything you need build projects with Maven.

To confirm that you can start Maven, run