How to Install Apache Maven on Ubuntu 18.04

How to Install Apache Maven on Ubuntu 18.04

Maven is java build tool that is based on POM (project object model). Instead of manually downloading dependency jar files in your project. Maven will automatically download the dependencies and put it on your project, for this we use pom.xml(Project object model). In the pom.xml file We will define the dependencies which we need for our project. Maven Generates documentation of your project, Compile the source code. Maven will Package compiled code into JAR files or tar or war file. Using maven we can deploy this artifacts into servers. in the follwoing steps i will show you how to install Apache Maven on Ubuntu 18.04/16.4 with step by step.

Install Apache Maven on Ubuntu 18.04

Java is the primary Prerequisite to Install Apache Maven on Ubuntu 18.04. So make sure that you installed Java on your Ubuntu 18.04/16.04. Apache Maven requires the JDK 1.7 or above so lets install java in your system by using below commands.

before install jave update your system with apt update command.

sudo apt update

install java

sudo apt install default-jdk

Verify java -version:

verify java installation with java -version command

ubuntu@ip-10-0-0-30:~$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3)
OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)

Java has been installed on the Ubuntu 18.04 server.

Install Apache Maven on Ubuntu 18.04

The official Ubuntu repositories contains Maven packages. So lets install Apache Maven on Ubuntu 18.04 with Apt command.

sudo apt install maven

Verify maven installation

verify maven version with mvn -version command.

ubuntu@ip-10-0-0-30:~$ mvn -version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-1032-aws", arch: "amd64", family: "unix"

we have successfully installed Apache Maven on Ubuntu 18.04/16.04

Leave a Reply

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