Maven is a build and dependency management tool for Java based application development. Just like other Java based development tools, it is not installed as Windows service, rather it is configured using windows environment variables.
In this maven tutorial, I am installing maven on a Windows 7 32bit machine.
Windows environment variables location:
Control Panel > All Control Panel Items > System > Advanced system settings > Environment Variables
Follow the steps needed to install maven on windows operating system.
Step 1) Install JDK and Add ‘JAVA_HOME’ Environment Variable
To install java, download JDK installer and add/update the JAVA_HOME
variable to JDK install folder.
Step 2) Download Maven and add ‘MAVEN_HOME’ and ‘M2_HOME’ Environment Variables
Maven can be downloaded from this location. I have extracted it in location – D:/Latest Setup/apache-maven-3.0.4
. You can choose your own location.
Set the M2_HOME
and MAVEN_HOME
variable to maven installation folder.
Step 3) Include ‘maven/bin’ directory in ‘PATH’ variable
To run maven from command prompt, this is necessary. Update the PATH
variable with 'Maven-installation/bin' directory
.
Step 4) Verify maven in console
Maven installation is complete. Now lets test it from windows command prompt.
- Go to start menu and type
cmd
in application location search box. - Press
ENTER
. A new command prompt will be opened. - Type
mvn -version
in command prompt and hitENTER
.
$ mvn -version
This should show the version information of maven installed. If there is any error shown, cross-check all above steps.
In this tutorial, we learned how to install maven on windows.
Happy Learning !!
saurav jain
Hi, I already have nodejs path in path variable…so What I do for it? I need nodejs path too.
Please reply asap. Thanks
asvin
just put ; and paste the path
Tanya
where did M2_HOME variable was set?
Kai Wang
MAVEN_HOME is same as M2_HOME
nikita
Java and Maven installed properly but “‘mvn’ is not recognized as an internal or external command, operable command or batch file” error occur in cmd.
Lokesh Gupta
Maven
/bin
folder should be inpath
environment variable.AndroidDoctorr
What does this mean?
Asha
I am not seeing Maven Dependency in Eclipse….any suggestion?
Lokesh Gupta
You will get some help from https://howtodoinjava.com/maven/maven-m2-repo-eclipse/
Also install maven plugin for eclipse.
bheem
could not find or load main class org.codehaus.plexus.classworlds. launcher error my system
I am using Windows 8
Jdk 8
Lokesh Gupta
maven 2 or maven 3? Try using variable M3_HOME instead of M2_HOME if you are using maven 3.
Pooja B Hundekar
Hi i have downloaded apache-maven-3.6.2 on windows machine and followed same steps still its not working
Lokesh Gupta
Make sure, you verify the maven command in “new command prompt window” if there is already any opened prompt.
Raunak
Thank you
Tanya
Excellent Thank you
kaarthik
thank you… it just took me 5 to 10 minutes to complete it…
Neha Insa
i enterd maven_home,java_home and path,,bt still not excecute on cmd
Lokesh Gupta
After updating environment variables, open a new command prompt window to test it.
Neha Insa
thanks ,,
Satheesh
HI , Firstly thanks for your blog n tutorials. Nicely explained How to configure Maven in window environment.
veerachandra
Hi Lokesh.. U did a grt job for the newbies..
Thanx a lot π
manoj
thanx bro its working
Ummer
Hi Lokesh,
Its very good article, if you post how to install maven on other OS then its sounds better.
Thanks