Install Maven in Windows

Apache Maven is a command-line tool for building and managing dependencies of Java-based applications.

Maven requires Java and before installing Maven in Windows it needs to ensure that Java Development Kit (JDK) is installed and JAVA_HOME environment variable is set.

As only this requirement is satisfied, you can download and install Maven.

In this note i will show how to install Maven in Windows, set the MAVEN_HOME environment variable and add Maven to PATH.

Cool Tip: How to find out a Java (JDK/JRE) version! Read more →

Install JDK

Maven requires Java, so first of all it is required to install Java Development Kit (JDK) and set JAVA_HOME environment variable.

Download and install JDK if it hasn’t been done yet.

Ensure that the JAVA_HOME environment variable is set.

Environment variable Description Example
JAVA_HOME JDK installation path D:\apps\jdk-13.0.2

Edit Environment Variables: To create/update an environment variable (JAVA_HOME, MAVEN_HOME, PATH, etc.) open the environment variables editor by pressing the ⊞ Win> keybutton to open the start menu and type in envi to search for “Edit the system environment variables” or “Edit environment variables for your account” links.

Install Maven in Windows

Download Maven’s binary zip archive and extract it to the desired location.

Set the MAVEN_HOME environment variable.

Environment variable Description Example
MAVEN_HOME Maven installation path D:\apps\apache-maven-3.6.0

To be able to execute the mvn command from the command prompt, open the environment variables editor one more time, search for the PATH environment variable, click on Edit and add the New entry: %MAVEN_HOME%\bin.

Verify Maven’s Installation

Press ⊞ Win + R, type cmd and press Enter to start a new command prompt.

Run the following command to verify the Maven’s installation in Windows:

C:\> mvn -version
Was it useful? Share this post with the world!

One Reply to “Install Maven in Windows”

  1. great!!! what to do if “set maven” shows information, but ” maven version” says it doesn’t internal or external command, programm or file))?

Leave a Reply