How to install maven on Ubuntu

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

This will helps you to install Apache Maven 3 on ubuntu.

Follow the steps to install:

Step1: Before you can install Maven you’ll need to update your repository details on your machine, simply run the following command in Terminal.

sudo apt-get update

Step2: To get all the available Maven package details run the command in a terminal.

apt-cache search maven

You will get output like this:

libapache-pom-java – Maven metadata for all Apache Software projects
libcommons-parent-java – Maven metadata for Apache Commons project
maven-ant-helper – helper scripts for building Maven components with ant
maven-repo-helper – Helper tools for including Maven metadata in Debian packages

Step3: Install maven package, run the following command.

sudo apt-get install maven

Step4: Once your installation completed, you can verify the installed maven package version.

mvn -version

You will the following output as results:

Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: “linux”, version: “3.2.0-67-generic”, arch: “amd64”, family: “unix”

Maven package where installed on, /usr/share/maven

Step5: Maven configuration files where stored in following location.

$ ls -lsrt /etc/maven/
total 16
12 -rw-r–r– 1 root root 10224 Jan 21  2012 settings.xml
4 -rw-r–r– 1 root root   184 Jan 21  2012 m2.conf

Now, Maven was successfully installed on your machine.

Permanent link to this article: