Skip to content

Install Maven


Due to a complex multi-modules tree structure, a recent version of maven is recommended, in particular maven >= 3.6.1.

Manual setup


Download maven and install it:

wget -P /tmp
sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt
sudo ln -s /opt/apache-maven-3.6.3 /opt/maven

Update your environment:

sudo vim /etc/profile.d/

Paste the following configuration:


# export JAVA_HOME=/usr/lib/jvm/default-java (only if not already set by Jenv)
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

Save and close the file. This script will be sourced at shell startup.

Make the script executable with chmod:

sudo chmod +x /etc/profile.d/

Finally load the environment variables using the source command:

source /etc/profile.d/

Verify the installation:

To validate that Maven is installed properly use the mvn -version command which will print the Maven version:

mvn -version