How to Install Apache Maven on Void Linux

Apache Maven is a build automation tool primarily used for Java projects. This tutorial will guide you through the steps to install Apache Maven on Void Linux.

Prerequisites

Before beginning this tutorial, ensure that you have the following:

Step 1: Update System

First, update the package repositories on your system.

sudo xbps-install -Su 

Step 2: Install Java

Apache Maven requires a Java Development Kit (JDK) to run. You can install the latest version of OpenJDK on Void Linux using the following command.

sudo xbps-install -S openjdk 

Step 3: Download and Extract Apache Maven

Download the latest version of Apache Maven from the official website using the following command.

sudo curl -O https://www-us.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz 

Next, extract the downloaded file to the /opt directory using the following command.

sudo tar -xzvf apache-maven-3.8.3-bin.tar.gz -C /opt/ 

Step 4: Set Environment Variables

Set the environment variables for Apache Maven by creating a new file named maven.sh in the /etc/profile.d/ directory using the following command.

sudo nano /etc/profile.d/maven.sh 

Add the following lines to the file:

export M2_HOME=/opt/apache-maven-3.8.3 
export PATH=${M2_HOME}/bin:${PATH} 

Save and close the file.

Step 5: Reload the System Environment

Reload the system environment to confirm the installation.

source /etc/profile.d/maven.sh 

Conclusion

Congratulations, Apache Maven is now installed on your Void Linux system. You can verify the installation by running the following command.

mvn -version 

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!