Tutorial

Installing Maven on Windows - Step-by-step Guide

Learn how to install Maven on Windows in this article. This step-by-step guide walks you through the process of downloading and setting up Maven on your Windows PC. All you need is a stable internet connection and the Java JDK version 8 or higher. Once installed, you can easily use Maven from the command line. With this guide, you will have Maven up and running in no time.

Prerequisites

  • A stable internet connection
  • Java JDK (Java Development Kit) version 8 or higher

Step 1: Download Maven

Download Maven from the official website: https://maven.apache.org/download.cgi. Select the current stable version and download the binary zip file.

Step 2: Extract Maven

Extract the downloaded zip file to a folder of your choice, e.g. C:\apache-maven.

Step 3: Set environment variable

To be able to run Maven from the command line, you need to set the MAVEN_HOME environment variable and add Maven's bin directory to the PATH environment variable.

  • Open the "System Properties" dialog box via the command prompt with the command sysdm.cpl.
  • Click the "Advanced" button and then the "Environment Variables" button.
  • Under "System Variables", scroll down and find the Path variable.
  • Click "Edit" and then "New".
  • Enter %MAVEN_HOME%\bin and click "OK".
  • Scroll down again and click "New".
  • In the "Variable" field, enter MAVEN_HOME and in the "Value" field, enter the path to the Maven directory, e.g. C:\apache-maven.
  • Click "OK" and close all dialog boxes.

Step 4: Test Maven

Open a command prompt and enter the command mvn -v. If Maven is installed successfully, the Maven version and the path to the Maven installation will be displayed.