To install Apache Maven on Windows, you just need to download the Maven’s zip file, and Unzip it to the directory you wish to install, and configure the Windows environment variables.
Tools Used :
- JDK 1.8
- Maven 3.5
- Windows 10
Maven 3.5 requires JDK 1.7 or above, while Maven 3.0/3.1 requires JDK 1.5 or above
1. JDK and JAVA_HOME
Make sure JDK is installed, and “JAVA_HOME” variable is added as Windows environment variable.
2. Download Apache Maven
Visit Maven official website, download the Maven zip file, for example : apache-maven-3.5.0-bin.zip. Unzip it to the folder you want to install Maven.
Assume you unzip to this folder – C:\Program Files\apache-maven
That’s all, just folders and files, installation is NOT required.
3. Add M2_HOME and MAVEN_HOME
Add both M2_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder.
Maven document said add M2_HOME only, but some programs still reference Maven folder with MAVEN_HOME, so, it’s safer to add both.
4. Add To PATH
Update PATH variable, append Maven bin folder – %M2_HOME%\bin, so that you can run the Maven’s command everywhere.
Done, to verify it, run mvn –V in the command prompt.
If you see a similar message, means the Apache Maven is installed successfully on Windows.