Categories
java maven

Set Maven Home in Windows

In this tutorial we will learn to set Maven home in windows.

Please refer my previous tutorial to download and install maven.

This is the follow up tutorial of my previous post

Prerequisites

Step 1

Copy Maven installed Path

In my case it is C:\Maven\apache-maven-3.6.3

Apache Maven Home

Step 2

Open My computer 

Step 3

Right click the This PC

Step 4

Click on Properties

Step 5

Click on Advanced system settings

Step 6

Click on the Environment variables

Step 7

Click New on the System variables column

Step 8

Enter Variable name as M2_HOME
Enter Variable value as C:\Maven\apache-maven-3.6.3
click ok
Note :
Variable name should be CAPS
Variable value should be as your maven installed path
don’t copy until bin folder

M2_HOME

Step 9

After Click OK
we can see the M2_HOME variable in environment variables

Step 10

After Click OK
we can see the M2_HOME variable in environment variables

Step 11

Now we need to need to add this JAVA_HOME to Path variable
Search for Path variable in same system variables window

Step 12

After selecting Path variable
Click on Edit button

Step 13

Edit environment variable dialog box will appear
Click on the New button

Step 14

Text box will appear on the list
add %M2_HOME%\bin in the text box

Step 15

Click OK after adding %M2_HOME%\bin
Now close all the windows

Step 16

We can verify by below steps
open the command prompt
type mvn -version

mvn -version

That’s it !! 

Related Articles

Create a Maven Project using command prompt

Leave a Reply

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