Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Installing Maven

You must first download Maven (please refer to the documentation).

Please refer to the appropriate section for the download you have obtained:

The final optional step is to set up a ${user.home}/build.properties file to customise your Maven installation. For information on the properties you can use, see the Properties Reference.

Windows Installer

Installing from the Windows Installer behaves like other Windows Installers: simply run the program and follow the prompts.

If you were updating a previous installation, you do not need to do anything further. Note that Maven does not overwrite a previous install, so you may want to remove it from Add/Remove Programs. This can be done safely at any time, as it does not affect your user profile.

During the process, you must select an installation directory. This will be set as MAVEN_HOME in your environment, however if you need to be able to run Maven from anywhere, you should add it to your path. To do this under Windows 2000 and Windows XP, open the Control Panel, and open the System panel. Under the Advanced tab, select the Environment Variables button. Create a new user variable (or edit it if it exists) to add %MAVEN_HOME%\bin (eg. PATH=%PATH%;%MAVEN_HOME%\bin). Note : Since Maven 1.1 RC1 the installer automatically adds %MAVEN_HOME%\bin in the path.

You will also need to define the JAVA_HOME environment variable. This variable should be the directory where a Java Development Kit is installed (note that a JRE is not sufficient). This directory will contain the bin, jre and lib directories.

Next, you should create your local repository by running the following command:

For Windows:
  %MAVEN_HOME%\bin\install_repo.bat %USERPROFILE%\.maven\repository

Notes:

  • This step is optional, but will save downloading several JARs a second time.
  • On Windows systems, your local repository is set by default to %USERPROFILE%\.maven\repository, which can be annoying when using roaming profiles, you can change its location using the maven.repo.local property.

To confirm that you can start Maven, run

maven -v

Other Archives

If you have downloaded an install archive, it contains 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 using tar or unzip.

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,
  • add MAVEN_HOME/bin to your path so that you can run the scripts provided with Maven.

If you are updating from a previous version, you do not need to do anything further. You can safely remove the old install if you wish as it does not contain any user profile information.

You will also need to define the JAVA_HOME environment variable. This variable should be the directory where a Java Development Kit is installed (note that a JRE is not sufficient). This directory will contain the bin, jre and lib directories.

Next, you should create your local repository by running the following command:

For Unix:
  $MAVEN_HOME/bin/install_repo.sh $HOME/.maven/repository

Note: This step is optional, but will save downloading several JARs a second time.

To confirm that you can start Maven, run

maven -v