Installing Apache Maven on ubuntu

By | November 13, 2017

This article will guide you on how to install Apache Maven on Ubuntu. Same instructions could be followed for other Linux distributions as well.

Get latest version of Maven binary from below official site.

Download Maven.

cd ~/Downloads

Extract and copy maven to local directory.

tar -xvf apache-maven-3.5.2-bin.tar.gz
mv apache-maven-3.5.2 /usr/local/

Set Maven command in environment variable.

Update ~/.bashrc – create this file if doesn’t exist.

vi ~/.bashrc

Add below lines at the end.

export MAVEN_HOME=/usr/local/apache-maven-3.5.2

Reload environment variables.

source ~/.bashrc

Check if “mvn” command works now.

mvn -version

If everything is good, you should see output like below.

Apache Maven 3.5.2
Maven home: /usr/local/apache-maven-3.5.2
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_144/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.8.0-36-generic", arch: "amd64", family: "unix"

Maven is installed now.

Leave a Reply

Your email address will not be published. Required fields are marked *