How to configure Maven in your local?

  1. Download maven

  • Download maven from []
  • This one – Binary zip archive
  • Save to your machine.

2. Set Maven Home in Windows 

  • In Windows 8:
  • Start -> All Apps -> Control panel -> System ->
    Advanced System Settings -> Advanced -> Environment variables.
  • Add M2_HOME, M2, MAVEN_OPTS to environment variables.
    Set the environment variables using system properties.
  • MAVEN_OPTS=-Xms256m -Xmx512m

(3) Add Maven bin directory location to system path

For this, append the string ;%M2% to the end of the system variable ‘Path‘.

(4)  Run command mvn -version from command prompt / address issues if any.

[issue] Sometimes you get the below error if JAVA_HOME is not already set in the Path. [ If you don’t get the below error, that means you have the supported Java version for the Maven you downloaded and you’re good.]


In-order to fix it set the JAVA_HOME .

SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45

and then execute mvn -version

[issue] This is what happens if Maven is higher version and jdk is less version.



Let’s try to resolve

SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45

and then execute mvn -version


C:\Users\java>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:4
Maven home: E:\maven\apache-maven-3.3.9-bin\apache-maven-3.3.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_45\jre
Default locale: en_US, platform encoding: Cp1252

Now, you see the Apache Maven version . So that means everything is good.

5) Notes:

In-order to avoid setting the JAVA_HOME each time you execute a mvn command, please set it in the Path in environment variables.