How To Install Maven On Windows?

In my previous article I have written about how to install Maven in Ubuntu?. It is much easier in the Linux OS then setting up in the Windows OS. As we know, Linux does the installation through its package manager and there is no need for the mannual settings of path or anything else. In windows, it’s quite easy too but we need to alter the set of environment variables to make it work. It is very easy to set up using the following steps. (Read : What is Maven? and Custom Plug-In for Maven).

1. Install Maven

Download the maven package from here and extract the zip file to the appropriate location. The toot folder
is the M2_HOME values when you are setting the environment variables. There is nothing else to be done for installing the maven package.

2. Set M2_HOME

Open the environment variables for your computer and set the M2_HOME as the maven’s home folder. Be sure to omit any quotation marks around the path even if it contains spaces. Also add the M2 variable in the environemnt variables section as “%M2_HOME%\bin”. Using the same dialog, add the MAVEN_OPTS environment variable in the user variables section to pass the JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
This is only optional parameter.

Maven Settings

3. Set Path

Add/ Update path variavles for environment and user sections. In the user variable, just append the %M2% to reflect the maven bin folder. In the environment variables section, update the path variable by appending %M2_HOME%\bin.

4. Verify the Maven Installation

The above steps ensure that all the required libraries are in the classpath. Now it is the time to check if the maven is installed properly. Open the command prompt and type mvn –version. If this results in the version details of the maven package, then it is installed properly. Otherwise verify the above steps if you have given the correct path for all the variables. mvn –version would out put the following details on your screen.

D:\>mvn --version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 07:45:3
Maven home: D:\Softwares\apache-maven-3.1.0
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!