Setting up your Maven Development Environment

Tihomir R. Todorov

Version 0.0.1
Copyright © 2010 Tihomir R. Todorov
11.21.2010
Revision History
Comment
Date
Name
tutorial.maven.set-up-your-maven-dev-env_0.0.1.v20101121-0506
Article created
11.21.2010
Tihomir R. Todorov

The tutorial describes how to manage two different Maven version on the same machine. For example, you have Apache Maven 2.2.1 on your machine and you want to install Apache Maven 3.0 too.

Hier we go ...

Downlaod Maven 3.0 from the website Maven Download or here and unzip the windows binaries (e.g. apache-maven-3.0-bin.zip) to a folder of your choice. I chose "C:\Portable\apache-maven-3.0" as my path.

If you downloaded the distribution archive from the website Maven Download you should make the following two steps:
  • remove the mvn.bat from "C:\Portable\apache-maven-3.0\bin"
  • download and copy the mvn3.bat to the same folder

Now, add the M3_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M3_HOME variable in the system variables with the value C:\Portable\apache-maven-3.0.

In the same dialog, add the M3 environment variable in the system variables with the value %M3_HOME%\bin.

Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.

In the same dialog, update/create the Path environment variable in the system variables and prepend the value %M3% to add Maven available in the command line.

In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Programme\Java\jdk1.6.0_22 and that %JAVA_HOME%\bin is in your Path environment variable.

Winkey + R->then type "cmd /K mvn3 --version"->ENTER to verify that it is correctly installed. You should see the following:

Done!