How to Install Apache Maven on EndeavourOS Latest
Apache Maven is a build automation tool used primarily for Java projects. It helps to manage and build Java projects by automating the build process. In this tutorial, we will guide you through the process of installing Apache Maven on EndeavourOS Latest.
Prerequisites
Before we begin with the installation process, make sure that you have the following prerequisites:
- A functioning EndeavourOS Latest server with sudo access
- Basic knowledge of Linux command-line interface (CLI)
Step 1: Update the system
Before proceeding with the installation process, update the system to ensure that all packages are up-to-date. Use the following command:
sudo pacman -Syu
Step 2: Install OpenJDK
Maven requires Java to be installed on your system. To install Java, use the following command:
sudo pacman -S jdk-openjdk
Step 3: Download Apache Maven
Next, download the latest version of Apache Maven from the official website. Use the following command to download:
wget https://apache.osuosl.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
Step 4: Extract the downloaded file
Once the download is complete, extract the downloaded file using the following command:
tar xvf apache-maven-3.8.4-bin.tar.gz
Step 5: Move the extracted files to the /opt directory
Now, move the extracted files to the /opt directory using the following command:
sudo mv apache-maven-3.8.4 /opt/
Step 6: Set up environment variables
In this step, you need to set up environment variables for Apache Maven. Create a new file called maven.sh in the /etc/profile.d/ directory.
sudo nano /etc/profile.d/maven.sh
Add the following lines to the maven.sh file:
export M2_HOME=/opt/apache-maven-3.8.4
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
Save and close the file.
Step 7: Reload environment variables
Reload environment variables using the following command:
source /etc/profile.d/maven.sh
Step 8: Verify the installation
Finally, verify the installation by running the following command:
mvn -version
This command should show you the Maven version installed on your system.
Congratulations! You have successfully installed Apache Maven on EndeavourOS Latest. You can now use Maven to manage and build your Java projects.