SEASON 3
Install latest maven on Ubuntu

Maven Installation

  1. 1.
    Get the latest maven from https://maven.apache.org/download.cgi
  2. 2.
    Choose a binary zip or tar archive (see Link header) and download with
1
wget https://downloads.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip
Copied!
  1. 1.
    Unzip and move to /usr/local/
1
unzip apache-maven-3.8.3-bin.zip
2
sudo mv apache-maven-3.8.3 /usr/local
Copied!
  1. 1.
    add to path and reopen terminal
1
export PATH=/usr/local/apache-maven-3.8.3/bin:$PATH
Copied!
or
1
ln -s /usr/local/apache-maven-3.8.3/bin/mvn /usr/bin/mvn
Copied!
  1. 1.
    mvn version check
1
$ mvn -version
2
3
Apache Maven 3.8.3 (...)
4
Maven home: /usr/local/apache-maven-3.8.3
5
Java version: 1.8.0_292, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
6
Default locale: en, platform encoding: UTF-8
7
OS name: "linux", version: "4.4.0-18362-microsoft", arch: "amd64", family: "unix"
Copied!

Troubleshooting

1 Command 'unzip' not found

1
$ unzip apache-maven-3.8.1-bin.zip
2
3
Command 'unzip' not found, but can be installed with:
4
5
sudo apt install unzip
Copied!
for installing unzip,
do:
1
sudo apt update
2
sudo apt install unzip
Copied!

2 The JAVA_HOME environment variable is not defined correctly

1
$ mvn -version
2
3
The JAVA_HOME environment variable is not defined correctly
4
This environment variable is needed to run this program
5
NB: JAVA_HOME should point to a JDK not a JRE
Copied!

3 check for java

Install Java as per the instructions in the next section.

Java Installation

1
$ java -version
2
3
Command 'java' not found, but can be installed with:
4
5
sudo apt install openjdk-11-jre-headless # version 11.0.11+9-0ubuntu2~20.04, or
6
sudo apt install default-jre # version 2:1.11-72
7
sudo apt install openjdk-8-jre-headless # version 8u292-b10-0ubuntu1~20.04
8
sudo apt install openjdk-13-jre-headless # version 13.0.4+8-1~20.04
9
sudo apt install openjdk-14-jre-headless # version 14.0.2+12-1~20.04
Copied!
for installing java:
1
sudo apt update
2
sudo apt install openjdk-8-jdk-headless
Copied!
use JDK not JRE. i.e., openjdk-8-jdk-headless instead of openjdk-8-jre-headless otherwise you would come across an error like: Unable to find javadoc command:The javadoc executable '/usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc'

Video

Run through of commands