2.3.2. Installing Maven on Microsoft Windows

Installing Maven on Windows is very similar to installing Maven on Mac OSX, the main differences being the installation location and the setting of an environment variable. This book assumes a Maven installation directory of c:\Program Files\apache-maven-2.2.1, but it won't make a difference if you install Maven in another directory as long as you configure the proper environment variables. Once you've unpacked Maven to the installation directory, you will need to set two environment variables—PATH and M2_HOME. To set these environment variables from the command-line, type in the following commands:

C:\Users\tobrien > set M2_HOME=c:\Program Files\apache-maven-2.2.1
C:\Users\tobrien > set PATH=%PATH%;%M2_HOME%\bin

Setting these environment variables on the command-line will allow you to run Maven in your current session, but unless you add them to the System environment variables through the control panel, you'll have to execute these two lines every time you log into your system. You should modify both of these variables through the Control Panel in Microsoft Windows.