Introduction

Apache Maven is a widely-used project management tool, primarily for Java projects. It handles project dependencies, builds, reporting, and documentation seamlessly. If you’re working with Java on Ubuntu, installing Maven can be a game-changer. Here’s how to do it.

Prerequisites

  1. An Ubuntu-powered computer.
  2. Java Development Kit (JDK) installed. Maven requires JDK to run.

Step-by-Step Guide of “How to install specific Maven 3.8.8 in ubuntu 20.04?”

To install a specific version of Apache Maven (in this case, version 3.8.8) on Ubuntu 20.04, you would typically download it directly from Maven’s official website and set it up manually. Here’s a step-by-step guide:

  1. Update the Server by below command:
Ubuntu@Rushi-InfoTech:~$ sudo apt-get update
  1. Download Maven 3.8.8: Navigate to a temporary directory and download Maven 3.8.8:

To Navigate to temporary directory:

Ubuntu@Rushi-InfoTech:~$ cd /tmp

To download the file we use with wget command:

Ubuntu@Rushi-InfoTech:~$ wget https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
  1. Extract the Archive: Extract the downloaded archive to a directory in /opt:
Ubuntu@Rushi-InfoTech:~$ sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt
  1. Create a symbolic link called maven leading to the Maven installation directory:
Ubuntu@Rushi-InfoTech:~$ sudo ln -s /opt/apache-maven-3.8.8 /opt/maven
  1. Set Up Environment Variables:
  • Use the Nano text editor to create and open the maven.sh script file in the /etc/profile.d/ directory:
Ubuntu@Rushi-InfoTech:~$ sudo nano /etc/profile.d/maven.sh
  • Add the following lines to the maven.sh file:
export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
  • Press Ctrl + X, then type Y and press Enter to save changes to maven.sh.
  • Make the maven.sh file executable using the chmod command:
Ubuntu@Rushi-InfoTech:~$ sudo chmod +x /etc/profile.d/maven.sh
  • Execute the maven.sh script file with the source command to set up the new environment variables:
Ubuntu@Rushi-InfoTech:~$ source /etc/profile.d/maven.sh

5. Verify Maven Installation:

Check the current version of Maven to verify the installation:

Ubuntu@Rushi-InfoTech:~$ mvn -version

Conclusion

With these steps, Apache Maven 3.8.8 should be installed and configured on your Ubuntu 20.04 system.

Any queries pls contact us
https://rushiinfotech.in/contact/

Similar Posts

Leave a Reply

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