Subject: Install Apache Maven
Author: Linux
In response to: How To Install Apache Maven on Ubuntu 16.04 Box
Posted on: 10/28/2017 06:29:57 AM
Step 1) Download the Apache Maven package
First go to http://maven.apache.org/download.cgi, find the tar.gz under Binary Distributions and download it to local Windows machine.
Step 2). Make the folder available
$ sudo mkdir /opt/maven
$ cd /opt
$ sudo chmod 777 maven
Step 3). Upload the downloaded package by WinSCPCopy apache-maven-3.5.2-bin.tar.gz onto /opt/maven
Step 4). Unzip the package
$ cd /opt/maven
$ tar xzf apache-maven-3.5.2-bin.tar.gz
The Maven content is under folder
/opt/maven/apache-maven-3.5.2Step 5). Verify it is working
$ cd /opt/maven/apache-maven-3.5.2
$ ./bin/mvn --version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T00:58:13-07:00)
Maven home: /opt/maven/apache-maven-3.5.2
Java version: 1.8.0_152, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_152/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-37-generic", arch: "amd64", family: "unix"
Step 6). Install Maven Linkage Format:
$ update-alternatives --install <link> <name> <path> <priority>
To create a link
/usr/bin/mvn named
mvn pointing to executable file
/opt/maven/apache-maven-3.5.2/bin/mvn
$ sudo update-alternatives --install /usr/bin/mvn mvn /opt/maven/apache-maven-3.5.2/bin/mvn 100
>
> On 10/28/2017 05:48:30 AM
Linux wrote:
Why Maven instead of Ant?
Convention over Configuration -- all Maven projects have a common structure, which makes it easier to understand each project.
Better dependency management -- Maven projects do not need to store third-party binary libraries in source control.
Easier to build huge project with multiple sub-projects.
Prerequisites
Java JDK installed and JAVA_HOME has been set up. Check here for details.
References: