Installation

Apache Maven can be installed by most package managers, or manually by downloading the archive and adding it to your path.

Prerequisites

You need a Java Development Kit (JDK) installed. Either set the JAVA_HOME environment variable to the path of your JDK installation or have the java executable on your PATH.

The current stable version 3.9.9 requires JDK 8+, but any recent version will work just fine.

Binary distribution

To install Apache Maven, extract the archive and add its bin directory to the PATH. This works on any operating system, but setting the path and environment variables depends on the OS.

Detailed steps are:

  1. Download the Apache Maven binary distribution archive.

  2. Extract the distribution archive in any directory. Use unzip apache-maven-3.9.9-bin.zip or tar xzvf apache-maven-3.9.9-bin.tar.gz depending on the archive.

  3. Add the bin directory of the created directory apache-maven-3.9.9 to the PATH environment variable

  4. Confirm with mvn -v in a new shell. The result should look similar to:

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /opt/apache-maven-3.9.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

That’s it! Maven is now installed.

macOS

Installation on macOS is supported by Homebrew, SDKMAN! and MacPorts.

Homebrew

brew install maven

SDKMAN!

sdk install maven

MacPorts

sudo port install maven3

Linux

The commands depend on the package manager of the Linux Distribution of your choice.

APT

sudo apt install maven

DNF

sudo dnf install maven

YUM

sudo yum install maven

Windows

Installation on Windows is supported by Chocolatey and Scoop.

Chocolatey

choco install maven

Scoop

scoop install main/maven