Install
Installing Maven is quite simple, but differs between operating systems. If these instructions don't work for you check out the Apache Maven website to see detailed instructions for specific operating systems.
Linux
The following instructions assume you have Ubuntu 18.04 or higher installed. Steps for other Linux distributions will differ.
- Update your package list:
sudo apt update
- Download and install Maven:
sudo apt install maven
MacOS
- Install Homebrew if you haven’t already:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Download and install Maven:
brew install maven
Windows
- Download the JDK installation file, and open it to run through the installation. Leave the default options unless you have a specific reason to change them. If you change the default installation location, make a note of it.
- Download the Maven binary zip archive.
- Extract the Maven zip file.
- Go into the extracted folder and copy the
apache-maven-3.6.0
folder toC:/Program Files
. - Assign the
JAVA_HOME
system variable:- Open the Start Menu.
- Search for
Environment Variables
and click Edit the system environment variables - In the Systems Properties Window → Click Environment Variables…
- Under “System Variables” → Click New.
- Variable name: Enter
JAVA_HOME
- Variable value: Enter the path of your JDK installation into the field. If you didn’t change anything during the JDK installation, it should be
C:\Program Files\Java\jdk-11.0.2
.
- Assign the
MAVEN_HOME
system variable:- Still under System Variables → click New
- Variable name: Enter
MAVEN_HOME
into the field. - Variable value: Enter the path of your Maven installation into the field. If you followed along with Step 4, it will be
C:\Program Files\apache-maven-3.6.0
.
- Add
%JAVA_HOME%
and%MAVEN_HOME%
to your PATH variable:- Still in the Environment Variables window → Under the “User variables for …” → Select the variable named Path → Then click Edit….
- Click New and enter
%JAVA_HOME%\bin
- Click New again, and enter
%MAVEN_HOME%\bin
- Click OK to close down the system windows.
- Open Command Prompt and enter
mvn --version
to check that everything is working.