How to install maven on windows 11

Published on December 24, 2021
Last updated December 24, 2021

In this installation guide we will be installing maven on windows 11.

Prerequisites

  1. jdk 1.8 or higher

Maven version 3.3 or higher require jdk 1.8 or higher.

jdk 1.8 is also known as java 8.

And you also need to have JAVA_HOME environment variable set to the location of your jdk.

1. Download and extract the maven package

If you have all the prerequisites then you can start installing maven.

First download the maven package from official maven site.

Click on the binary zip archive and download it. download maven zip archive

After downloading the maven package extract it to a location of your choice.

Personally I prefer to create a programs folder in my C drive and extract maven to that folder.

2. Add maven to path

After extracting the maven package you need to add the location of the maven executable to your path environment variable.

To do this

  1. locate the bin folder in the maven extracted folder
  2. Right click on the bin folder and select Copy as path

mine looks like this: C:\Programs\apache-maven\apache-maven-3.8.4\bin yours will vary depending on your extracted location.

Open the environment variables menu

To open the environment variables menu search for environment variables in windows search bar and click on the Edit the System Environment Variables button. edit system environment variables

In the window that appears click on Environment Variables at the bottom of the window.

Edit path

In the System Environment Variables window click on Path and then click Edit button at the bottom of the window. edit path

In the Edit environment variables window that appears click New button at the top of the window.

And paste the path you copied from the previous step.

Make sure you remove the quotation marks(”) from the path.

Click on OK button at the bottom of the window to save the changes. save path

Open a new command prompt and type mvn -v to verify that maven is installed.

You should see something like this:

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\Programs\apache-maven\apache-maven-3.8.4
Java version: 17, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

If you get the error message

'mvn' is not recognized as an internal or external command, operable program or batch file.

then please make sure you have copied the path to maven bin folder correctly.

And that you have properly click ok to save your changes

And also you need to open a new command prompt for changes in environment variables to take effect.



Tags :