How to Download and Install Apache Maven on Windows

2 minute read

download install apache maven windows

Do you want to download and install the latest version of Apache Maven on Windows?

Then check this out:

In this tutorial, I’ll show where to download Maven.

How to configure it.

(And above all) how to check if everything is working.

So here we go.

Check following posts if you are looking to download and install Maven 3.2.2, Maven 3.2.5, Maven 3.3.9 or Maven 3.5.0.

What is Apache Maven?

Maven is a build automation tool. It addresses two aspects of building software:

  • It describes the different steps in the build process.
  • It describes the dependencies to other modules and components.

The Maven project is part of the Apache Software Foundation. Which is a decentralized open source community of developers.

Step #1: Check Prerequisites

Maven requires Java to work. So let’s check if you have Java configured on your system.

Click on the search button. Then type “cmd” (without quotes).

If you have Windows 7 click on the Windows button.

Click on the Command Prompt shortcut.

windows search cmd

Wait for the command prompt to open.

Type “java -version” and press ENTER.

java version command

The above command prints the installed Java version.

java installed version

For Maven 3 you need Java version 1.7 or higher.

If you do not have Java installed on your system. Check following post which details how to install a JDK on Windows 10.

Step #2: Download

Go to the Maven download page.

apache maven download page

Scroll down to the Files section.

Click on the Binary zip archive link.

At the time of writing the latest stable Maven release was version: 3.5.4.

apache maven download binary zip archive

Wait for the download to complete.

Step #3: Install

Open the location of the downloaded installer.

apache maven downloaded binary

Right-click the ZIP archive file. Select Extract All….

apache maven downloaded binary extract all

Select an extract destination for the Maven files.

In this example, we extract in C:\Users\Downlinko\tools\maven.

maven extract destination

Click on Extract. This extracts all Maven files under C:\Users\Downlinko\tools\maven\apache-maven-3.5.4.

From now on we refer to this location as [MAVEN_INSTALL_DIR].

apache maven install dir

Step #4: Setup

We need to set up an environment variable that will point to our Maven installation.

Click on the search button. Then type “env”.

If you have Windows 7 click on the Windows button.

Click on the Edit environment variables for your account shortcut.

windows search env

Wait for the environment variables window to open.

Click on New….

windows account environment variables jdk new

Enter “M2_HOME” as variable name. Enter the [MAVEN_INSTALL_DIR] as variable value.

In this tutorial the installation directory is: C:\Users\Downlinko\tools\maven\apache-maven-3.5.4.

Click OK.

apache maven home variable

Next, we need to configure the PATH environment variable so we can run Maven from a command prompt.

Select the PATH variable. Click on Edit….

apache maven edit path variable

Click on New and type “%M2_HOME%\bin” as shown below.

Click OK.

maven path variable

Click OK once more to close the environment variables window.

apache maven windows account environment variables

On Windows 7 you cannot add extra values for an existing Path variable. You need to append “;%M2_HOME%\bin” at the end of the variable value instead.

Step #5: Test

To test the setup click on the search button. Then type “cmd”.

Click on the Command Prompt shortcut.

windows search cmd

Wait for the command prompt to open.

Type “mvn -version” and press ENTER.

maven version command

The above command prints the installed Maven version.

maven 3-5-0 version output

Congratulations, you have installed Apache Maven on Windows 10!

Now it’s time to create your first Maven project.

Go ahead and leave a comment if you liked this post.

Thanks!

Leave a comment