How to install Apache Maven 3.3.9 on Linux mint 18.3
To install Apache Maven &ndash 3.3.9 on Linux mint &ndash 18.3
Apache Maven is a project management tool for managing the building, reporting and documenting of Java-based development project. It contains a project object model, a set of standards, a project lifecycle, a dependency management system and logic. Maven is designed to provide a sample project setup for users to have an easy environment.Maven addresses two parts of building a software, first, it describes how a software is built and second its dependencies. This tutorial covers the installation procedure of Apache Maven on Linux mint &ndash 18.3.
Installing Apache Maven
First, update the system repository by making use of the following command.
linuxhelp user # apt-get update
Get:1 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Ign:3 http://packages.linuxmint.com sylvia InRelease
Get:4 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [3,128 B]
Hit:5 http://packages.linuxmint.com sylvia Release
Get:6 http://archive.canonical.com/ubuntu xenial/partner i386 Packages [3,116 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
.
.
Get:15 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [282 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [689 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [601 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [557 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [243 kB]
Fetched 4,643 kB in 8s (576 kB/s)
Reading package lists... Done
And once it is done, you need to add the repository by running the following command.
linuxhelp user # add-apt-repository ppa:webupd8team/java
You are about to add the following PPA:
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.
Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html
Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.
More info (and Ubuntu installation instructions):
.
.
More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press Enter to continue or Ctrl+C to cancel
Executing: /tmp/tmp.7yLzDz66ei/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv-keys
EEA14886
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: public key " Launchpad VLC" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Once again, you need to update the system repository by making use of the following command.
linuxhelp user # apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://archive.canonical.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:4 http://packages.linuxmint.com sylvia InRelease
Get:5 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17.5 kB]
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:8 http://packages.linuxmint.com sylvia Release
Get:10 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main Sources [1,408 B]
Get:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 Packages [2,908 B]
Get:12 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 Packages [2,460 B]
Get:13 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main Translation-en [1,260 B]
Fetched 25.6 kB in 2s (10.5 kB/s)
Reading package lists... Done
You shall now proceed with the installation of Oracle Java by making use of the following command.
linuxhelp user # apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho
| ttf-sazanami-mincho ttf-arphic-uming
Recommended packages:
gsfonts-x11 oracle-java8-set-default
The following NEW packages will be installed:
oracle-java8-installer
.
.
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
Oracle JDK 8 installed
#####Important########
To set Oracle JDK8 as default, install the " oracle-java8-set-default" package.
E.g.: sudo apt install oracle-java8-set-default
On Ubuntu systems, oracle-java8-set-default is most probably installed
automatically with this package.
######################
You shall now check java version by making use of the following command.
linuxhelp user # java -version
java version " 1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
And then, you need to change the directory.
linuxhelp user # cd /opt/
You shall now download the package of apache maven by running the following command.
linuxhelp opt # wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
--2018-03-20 14:30:25-- http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
Resolving www-eu.apache.org (www-eu.apache.org)... 195.154.151.36, 2001:bc8:2142:300::
Connecting to www-eu.apache.org (www-eu.apache.org)|195.154.151.36|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8491533 (8.1M) [application/x-gzip]
Saving to: ‘ apache-maven-3.3.9-bin.tar.gz’
apache-maven-3.3.9-bin.tar.g 100%[=============================================> ] 8.10M 47.2MB/s in 0.2s
2018-03-20 14:30:45 (47.2 MB/s) - ‘ apache-maven-3.3.9-bin.tar.gz’ saved [8491533/8491533]
And then you need to extract the packages by making use of the following command.
linuxhelp opt # tar -zxvf apache-maven-3.3.9-bin.tar.gz
apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar
apache-maven-3.3.9/lib/maven-embedder-3.3.9.jar
apache-maven-3.3.9/lib/maven-settings-3.3.9.jar
apache-maven-3.3.9/lib/plexus-utils-3.0.22.jar
apache-maven-3.3.9/lib/maven-core-3.3.9.jar
.
.
apache-maven-3.3.9/conf/
apache-maven-3.3.9/conf/logging/
apache-maven-3.3.9/conf/logging/simplelogger.properties
apache-maven-3.3.9/conf/settings.xml
apache-maven-3.3.9/conf/toolchains.xml
apache-maven-3.3.9/lib/ext/
apache-maven-3.3.9/lib/ext/README.txt
You can now list out the file.
linuxhelp opt # ls
apache-maven-3.3.9 apache-maven-3.3.9-bin.tar.gz
Then, you need to rename the extracted file.
linuxhelp opt # mv apache-maven-3.3.9 maven
You need to set an environment variable for Maven. Open the file.
linuxhelp opt # vim /etc/profile.d/mavenenv.sh
And add the following lines to it.
[..] #!/bin/bash MAVEN_HOME=/opt/maven PATH=$MAVEN_HOME/bin:$PATH export PATH MAVEN_HOME export CLASSPATH=. [..]
After that, you need to make the executable for environment file.
linuxhelp opt # chmod +x /etc/profile.d/mavenenv.sh
Next, you need to set the environment variables permanently.
linuxhelp opt # source /etc/profile.d/mavenenv.sh
Afterward, you need to check the maven version by making use of the following command.
linuxhelp opt # mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5 2015-11-10T22:11:47+05:30)
Maven home: /opt/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: " linux" , version: " 4.10.0-38-generic" , arch: " amd64" , family: " unix"
If you want to check the path and environment variables
linuxhelp opt # echo $MAVEN_HOME /opt/maven linuxhelp opt # echo $PATH /opt/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
With this, the tutorial comes to an end.
The following information is what is best to provide:
Project name
Project URL
License
Description of the project
Group and Artifact ID
Packaging
Version
Dependencies
" Cmake, Gradle, Ant, Scons, GNU Make, Rake"