How to install Maven on Windows

Maven is a powerful project management tool that is based on POM (project object model).

It is used for projects to build, dependency, and documentation.

It simplifies the build process and it's too much advanced than ANT.

It is a tool that can be used for building and managing any Java-based project. Maven makes life easy for Java developers for the build process.

In this maven tutorial, We will install a maven on a Windows 10 64bit machine.

Installing Maven on Windows

Maven requires JDK to execute. Maven 3.3+ requires JDK 1.7 or latest version

Download java

Go to the page

https://www.oracle.com/java/technologies/javase-jdk14-downloads.html

Select Windows x64 Compressed Archive as shown below.


Select java to download


Download the zip file.

After downloading, extract the file in your favorite location. Generally, java will put in location.
C:\Program Files\Java


Setting up Environment Variables – JAVA_HOME and Path

"Control Panel ---> System and Security ---> Advanced System Setting"


In the "System Properties" popup,

Go to the "Advanced" tab and click on the "Environment Variables" button.


This will open a new popup window to edit user and system environment variables.

Now, create a new system environment variable "JAVA_HOME" with value as the location of the JDK folder.

as
JAVA_HOME C:\Program Files\Java\jdk-14.0.2


Also, add the JDK bin folder to the Path variable list of directories.


as
%JAVA_HOME%\bin

save all the settings.

Verifying Java Installation through Command Prompt

Open the command prompt and run the command java -version


Install Maven on Windows

Verify you have JDK in your windows machine using the command.

java -version

Download Maven Binary zip Archive

Open the URL: https://maven.apache.org/download.cgi

Download the "Binary zip archive" as shown in the below image


Setting up Maven Environment Variables – M2_HOME, MAVEN_HOME, and Path.

After downloading the zip archive extract the files to C:\Program Files\Maven location as shown below.


Then open environmental variables and add path for both M2_HOME MAVEN_HOME.



Then edit Path Variable and put the value as,

%M2_Home%\bin


Save all windows.

Verifying Maven Installation

To verify whether the maven installed or not.

Open new command prompt window and run the command as,

mvn -v

If you see the output as given below.


then you successfully installed a maven on windows.


Post/Questions related to How to install Maven on Windows

Maven – Settings File
Maven – Dependency Management
Maven Dependency Scopes
Understanding Maven – pom.xml File
Parent and Child POM Example
Local, Remote and Central Repositories in Maven
Maven local repository location, set custom Location
Change Maven repository location in eclipse
Maven proxy settings – Eclipse, command line and global settings
Maven Enforce Minimum Java Version
Maven Create Java Project- Example
Create a maven web project in eclipse step by step
Create a Multi-module Maven project using Console
Create a multi-module project in eclipse
Create Java source folders using Maven
Maven Bill Of Materials Dependency - Maven BOM
Import Maven Remote Archetype Catalogs in Eclipse
Create Custom Archetype from Eclipse Project Using Maven Java compiler level does not match the version of the installed Java project facet
Generate build.xml from pom.xml using Maven ant plugin
Create the IntelliJ Idea Project using Maven
Uber jar / Fat Jar Example using Maven Shade Plugin
Install | Set JAVA_HOME in Ubuntu 19.10 | 20.04
How to install Maven on Ubuntu 19.10 | 20.04

In this article, we have seen How to install Maven on Windows.