Skip to content

Maven Installation: Windows

Kyle Clemens edited this page May 25, 2014 · 6 revisions

Downloading Maven

First, you will need to download Maven, of course! Head over to Apache Maven, and pick a version to download.

Note: The recommended version to download and use is 3.2.1. It's the latest stable release for Maven. Using an older outdated version can lead to errors due to the non-supported version.

Once you've done that, unzip the archive you just downloaded to a directory of your choice. In this case, I've extracted mine to

C:\Program Files\Apache-Maven\3.2.1

Setting up your environment variables

Once you've got it extracted to your directory of choice, it's time to set up your environment variables so you can use Maven from the command prompt

Note: I'll be assuming you're using JDK1.7.0, have your Java installed at C:\Program Files\Java\, and downloaded Maven version 3.2.1.

Alright, lets get started! Enter these commands to set up your environment variable settings:

set M2_HOME=C:\Progra~1\Apache-Maven\3.2.1 # Progra~1 is just a shortcut for \Program Files\
set JAVA_HOME=C:\Progra~1\Java\jdk1.7.0 # Note, replace jdk1.7.0 with your java version!
set PATH=%PATH%;%M2_HOME%\bin

You can also do this without using the command prompt by going to Control Panel/All Control Panel Items/System, clicking on Advanced System Settings, and, from there, going into the Advanced tab and hitting Environment Variables.

Once you've managed to open up your environment variables, click on New, and add a new variable to the System Variables section called M2_HOME. Set its path to wherever you've downloaded and extracted Maven to. In my case, again, it'll be C:\Program Files\Apache-Maven\3.2.1. Now hit OK.

After you've added Maven's environment variable, we've got to add it to the PATH variable as well. To do that, find the variable in the System Variables section and hit Edit. At the end of the PATH variable's path settings, add ;%M2_HOME%/bin # Notice the ';'!.

Exit out of your environment settings by hitting OK and Apply. You may need to close any open command prompts for changes to take effect.

Verify your installation

Now let's check if we've got everything set up right! Enter the command:

mvn --version

If you get something back like Apache Maven 3.2.1 ..., you've successfully installed Maven and are good to go!

If you have any questions (about the contest, git, Maven etc), please don't hesitate to send us a tweet @tenjava or ask in our IRC channel.

Clone this wiki locally