How To Install Apache 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 article explains about how to install apache maven on Ubuntu.

To install apache maven, it should require pre-installed java on Ubuntu. To verify java version, use the following command –

$ java -version

The sample output should be like this –

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

If you wants to install java on Ubuntu, read this article

To install maven, use the following command –

$ sudo apt-get install maven

The sample output should be like this –

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   ant ant-optional junit junit4 libaopalliance-java libapache-pom-java
   libasm4-java libatinject-jsr330-api-java libbsh-java libcdi-api-java
   libcglib3-java libclassworlds-java libcommons-cli-java libcommons-codec-java
   libcommons-httpclient-java libcommons-io-java libcommons-lang-java
   libcommons-lang3-java libcommons-logging-java libcommons-net-java
   libcommons-net2-java libcommons-parent-java libdom4j-java libdoxia-core-java
   libeasymock-java libeclipse-aether-java
   libgeronimo-interceptor-3.0-spec-java libguava-java libguice-java
   libhamcrest-java libhttpclient-java libhttpcore-java libjaxen-java
   libjaxp1.3-java libjdom1-java libjetty-java libjsch-java libjsoup-java

To verify the maven version, use the following command –

$ mvn -version

The sample output should be like this –

Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-57-generic", arch: "amd64", family: "unix"

In this post, we have learned some very useful information about – “How To Install Apache Maven on Ubuntu”. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!

Updated on: 01-Mar-2024


Kickstart Your Career

Get certified by completing the course

Get Started