How To Install Maven On Windows?

SHARE & COMMENT :

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
D:\Softwares\apache-maven-3.1.0
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
2+0530)
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"
D:\>

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Trackbacks

  1. […] you can choose the Java implementation with Maven build (Read : How to Install Maven on Windows / Ubuntu ?). As a first step, you have to create create the pom.xml with the following […]

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better