How to install Maven on Windows
To install Apache Maven on Windows, you just need to download the Maven’s zip file, unzip it to a folder, and configure the Windows environment variables.
Tested with :
- JDK 10
- Maven 3.6
- Windows 10
- Maven 3.3+ requires JDK 1.7+
- Maven 3.2 requires JDK 1.6+
- Maven 3.0/3.1 requires JDK 1.5+
1. JDK and JAVA_HOME
Make sure JDK is installed, and
JAVA_HOME environment variable is configured.
Please read this how to add JAVA_HOME on Windows 10
2. Download Apache Maven
2.1 Visit Maven official website, download the Maven zip file, for example :
2.2 Unzip it to a folder. In this article, we are using
That’s all, just download and unzip, installation is NOT required.
3. Add MAVEN_HOME system variable
MAVEN_HOME system variables, and point it to the Maven folder.
3.1 Press Windows key, type
adva and clicks on the
View advanced system settings
3.2 In System Properties dialog, select
Advanced tab and clicks on the
Environment Variables... button.
3.3 In “Environment variables” dialog,
System variables, Clicks on the
New... button and add a
MAVEN_HOME variable and point it to
4. Add %MAVEN_HOME%\bin To PATH
In system variables, find
PATH, clicks on the
Edit... button. In “Edit environment variable” dialog, clicks on the
New button and add this
Done, start a new command prompt, type
mvn –version :
C:\Users\mkyong>mvn -version Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00) Maven home: C:\opt\apache-maven-3.6.0\bin\.. Java version: 10.0.1, vendor: Oracle Corporation, runtime: C:\opt\Java\jdk-10 Default locale: en_MY, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows" C:\Users\mkyong>echo %MAVEN_HOME% C:\opt\apache-maven-3.6.0
The Apache Maven is installed successfully on Windows.
6.1 ‘mvn’ is not recognized as an internal or external command?
> mvn -version 'mvn' is not recognized as an internal or external command, operable program or batch file.
Answer: Refer to Step 4, make sure the
%MAVEN_HOME%\bin is added to the
PATH system variable.
6.2 The JAVA_HOME environment variable is not defined correctly
> mvn -version The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE
Answer: Refer to Step 2, make sure JDK is installed and the
JAVA_HOME system variable is configured.