How to Install Maven on Windows

In the previous post, we have learnt about Maven. In this post, we will see How to Install Maven on Windows.

Download Apache Maven:

Visit Apache Maven official website https://maven.apache.org/download.cgi. to download maven zip file apache-maven-3.3.3-bin.zip.

Maven zip file

After downloading file, unzip it and store it at any desired location.You will be able to see the file as shown below. That’s why, we can say it is Maven configuration instead of Maven installation.

Maven path

Note: You must have java configured at your system as we have seen in this post.

Note: Maven 3.2 and 3.3 require JDK 1.6 or above, while Maven 3.0/3.1 requires JDK 1.5 or above.

Configuring System Variable:

Step#1 In windows 7, right click on computer icon and go to properties.

Computer Properties

Step#2 Go to Advance System settings, a new window will open where we need to click on a button called “Environment Variable“.

Advanse system property

Step#3 We need to create a new system variable named as M2_HOME and its value should be the path where Maven unzipped file stored.

New System Variable

Step#4 This is optional step. You can create one more System variable named as MAVEN_HOME , and you can provide the same path into the value as given for M2_HOME.

In Maven documents, it is said to add M2_HOME only, but some programs still may refer Maven folder with MAVEN_HOME, so, it’s safer to add both.

Step#5 We need to add bin folder path of Maven to system variable path. Either you can use full path like C:\Personal\Tools\apache-maven-3.3.3\bin or %M2_HOME%\bin.

Add a semicolon (;) in the end of the path value, and add you Maven bin folder path.

M2_HOME

Attention

Do not change any thing else in the path variable, because it has important information about your system components.

Verify if Maven has been configured correctly:

Open a command window and type mvn –version and hit Enter.

C:\Users\Shekar Sharma>mvn –version

If you see the message as shown below, that means Maven has been installed successfully.

Maven installed


 

Ask Question
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...