How to install Maven on Windows

Installing Maven on Windows requires few steps. Just download it in some folder, set it in the path and define the environment variable M2_HOME

Read this post with the steps to install Maven

Summary of steps

  1. Download maven https://maven.apache.org/download.cgi
  2. Add folder < maven >\bin to path
  3. Create a M2_HOME environment variable with the maven path
  4. Verify with mvn -v command

Download the latest version of Maven and unzip it

Download from https://maven.apache.org/download.cgi

For this example, I have downloaded and unzip maven in

C:\developer\apache-maven

Define the environment variables

Add Maven \bin to your Path and create an M2_HOME environment variable.

Open the System Properties by pressing Windows + R and type sysdm.cpl

Then in the Advanced tab, enter Environment Variables and add to Path C:\developer\apache-maven\bin (including the \bin folder)

 

Maven

In the same window add a new variable M2_HOME with the path where you have maven, in this example C:\developer\apache-maven\

 

Maven

Make sure you have JAVA_HOME well defined in your environment variables pointing to Java.

Maven

Check if everything is ok

Again press Windows + R and then type cmd to enter the windows console.

In the console check with mvn -v. You should see a similar message.

    Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T08:57:3
    7-03:00)
    Maven home: C:\developer\apache-maven\bin\..
    Java version: 1.8.0_60, vendor: Oracle Corporation
    Java home: C:\Program Files\Java\jre1.8.0_60
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Hi! If you find my posts helpful, please support me by inviting me for a coffee :)
Maven 

See also