This is a step by step guide on how to install Maven on Windows 10 Operating Systems manually and from Command line.
Make sure Java JDK installation 1.7 or higher OR GraalVM for Java 8 or higher installed in your system and already set JAVA_HOME system path. In Any system following are the 3 basic steps to setup Maven.
- Get appropriate Maven binary distribution from official Maven site.
- Create an MAVEN_HOME System Variable.
- %MAVEN_HOME%\bin; to your System Path.
1. Download Apache Maven
To install Maven on Windows 10, download binary zip archive from apache-maven-3.xxx-bin.zip, extract it in your local system.
2. Add MAVEN_HOME System Variable
To add MAVEN_HOME System variable on windows :
1. Press on Windows key -> type Environment -> Select “Edit the system environment variables“
2. Select Environment Variables… button.
3. Click on New… button and add MAVEN_HOME and your extracted path. Ex:
3. Add %MAVEN_HOME%\bin to PATH
In System variables, select Path -> click on Edit… option -> In Edit environment variables window click New -> include %MAVEN_HOME%\bin
That’s all, manually setting up Maven on Windows is done. Let’s have a look into how to setup MAVEN_HOME and bin path from command line.
4. Setup MAVEN_HOME System variable and update PATH from Command line on Windows
1. To set System variables from command line, open cmd command prompt as administrator and issue following command.
C:\Windows\system32>setx /M MAVEN_HOME "Z:\D\maven\apache-maven-3.6.3" SUCCESS: Specified value was saved.
2. Update %MAVEN_HOME%\bin from command line.
$ setx /M PATH "%MAVEN_HOME%\bin;%PATH%"
5. Test Maven Setup on Windows
To test maven installation successful, just try
mvn -version from command prompt, you will get similar following results.
$ mvn -version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: Z:\D\maven\apache-maven-3.6.3\bin\.. Java version: 11.0.7, vendor: GraalVM Community, runtime: Z:\D\graalvm\graalvm-ce-java11-20.1.0 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
In this guide we have seen how to install Maven on Windows 10 OS. When you tried to setup maven in your Windows OS by following above steps, you came across any issue? comment below.
Other Maven Guides:
- Install Maven on Mac
- Install Maven on Ubuntu
- Import maven project into Eclipse
- Maven Skip Tests
- Maven run single test
- Maven set java version
- Maven run java main class