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.