Skip to content

Maven 3 Installation

If you think you have Maven installed, you can check by doing:

mvn -v

at the command line. If it's not found, then install following these instructions.


Pre-Requisites

You must have Java already installed in order to install and validate Maven. See here for checking your Java installation.

Download the Binary

Go to the download page and select either the Binary tar.gz archive or the Binary zip archive.

You can then follow the instructions here or as summarized below.

For Mac, it's recommended to use the brew package manager: brew install maven


Extract the Binary

Extract the distribution into your preferred directory such as /usr/local/apache-maven for Mac/Linux or C:\bin for Windows.

Environment Variables

Mac/Linux

Open a terminal and set environment variables from the command line, replacing /usr/local/apache-maven with the directory that you chose above:

export M2_HOME=/usr/local/apache-maven/apache-maven-3.6.0
export M2=$M2_HOME/bin

Windows

Set these environment variables through the Control Panel, replacing <path to install> with the directory that you chose above:

M2_HOME=C:\<path to install>\apache-maven-3.6.0
M2=%M2_HOME%\bin

Add Maven to the PATH

Windows

Append the string ;%M2% to the PATH system environment variable.

Mac/Linux

Set the PATH directly, or update your shell profile:

export PATH=$M2:$PATH

Validate mvn

At the command line, type the following:

mvn -v

And you should see the Maven and Java version information displayed, something like:

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T12:41:47-06:00)
Maven home: /usr/local/Cellar/maven/3.6.0/libexec
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"