How to install and setup Maven Environment on windows?

By | October 24, 2020

In this post, We will talk and learn about How to install and setup Maven Environment on windows?

Maven is a build automation and dependency management tool for Java-based application development. One thing you should always keep in mind that Maven is not installed as a Windows service, instead it is configured using windows environment variables.

In this maven post, I am going to show you how to install maven on a Windows 10 64 bit machine.

Make sure  that JAVA_HOME the environment variable is set and points to your JDK installation

NOTE: Similar steps can be used for other windows operating system

First of all, you have to Download Maven Archive from the Apache website

Once You download Maven Archive, after that extract the archive to the directory you wish to install. In the extracted folder you will see files and folder as shown in the below image:

 

Now Let’s see how we can set up Maven HOME and PATH on windows.

Follow the below steps to install a maven on the windows operating system.

Windows environment variables location:
Right-click on MyComputer->Properties->Advanced system settings->Advanced->Environment Variables

  1. Right Click on your computer name ->Properties as shown in this Image:

2. Click on Advanced system settings

3. Select Advanced tab 

4.Click on Environment Variables

5.Now you will get two sections in Environment Variables A). User Variables B). System variables, If You are working on a personal computer as an Administrator then you can set Maven HOME and PATH on either user or system level variables but If you are working on any organization then you might not have administrator privilege so You will have to set Maven HOME and PATH in User variables section.

Click on the New button in the User Variables section then provide Variable name: M2_HOME and Variable value:E:\Softwares\apache-maven-3.6.3-bin\apache-maven-3.6.3  —>(This value might differ in your case, Make sure that you are provided the correct path)

Finally, Click on the OK button

Again Click on the New button in the User variables section,

then provide Variable name: MAVEN_HOME and Variable value:E:\Softwares\apache-maven-3.6.3-bin\apache-maven-3.6.3  —>(This value might differ in your case, Make sure that you are provided correct path)

Finally, Click on the OK button

6. Now let’s set up the Maven path in the environment variables

To set up a maven path first of all you have to check if the Path variables already existing(if the path does not exist then click on New button in User Variables then provide Variable name:PATH or Path or path and Variable value:%MAVEN_HOME%\bin ) in the User variables section then select that Path and click on Edit and add maven path :E:\Softwares\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin  as shown in the below image.

7. Now Final Step is to verify maven installation: Open Command Prompt and type mvn -v or mvn -version and press Enter, if you see similar output as below that means you are done with Maven HOME and PATH setup.

 

That’s all about How to install and setup Maven Environment on windows?
If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

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