How to Install Maven in Windows


  1. First, install JDK. Click here to know how to install JDK.
  2. Then visit Maven Official Site and download apache-maven-3.5.3-bin.zip.
  3. Then unzip this file to any folder.
  4. Goto Control panel -> System -> Advanced System Settings -> Environment Variables. Then add M2_HOME and MAVEN_HOME. Give value of both as the path of the unzipped folder.
  5. Then update PATH variable, append %M2_HOME%\bin in Path variable, so that you can run the Maven’s command everywhere.
  6. Then test whether your maven installation is proper by typing mvn -version in command prompt. Then I got an error as shown below.
  7. To remove this error, add JAVA_HOME. Give the path of your JDK here.
  8. Then again test whether your installation is proper by typing mvn -version in command prompt. Then I got the message as shown below. Thus I have completed the maven installation successfully.