Apache Maven is a popular build automation tool used primarily for Java projects. In this tutorial, we will be installing Apache Maven on the latest version of OpenSUSE.
Before installing any new software, it is recommended to update the system with the latest patches and security fixes. To do this, open the terminal and enter the following command:
sudo zypper update
This will update your existing packages to the latest version.
Apache Maven requires Java to run. To install Java on your OpenSUSE system, run the following command:
sudo zypper install java-11-openjdk-devel
This will install the OpenJDK 11 development kit, which is required by Apache Maven.
You can download the latest version of Apache Maven from the official Maven website at http://maven.apache.org/download.cgi. Once you have downloaded the binary tar.gz file, extract it to a location of your choice. In this tutorial, we will extract it to the /opt directory.
To extract the file, open the terminal and enter the following command:
sudo tar xzvf apache-maven-3.8.1-bin.tar.gz -C /opt
Replace "apache-maven-3.8.1-bin.tar.gz" with the name of the file you downloaded, and "/opt" with the location where you want to extract it.
To use Apache Maven, you need to add some environment variables to your system. These variables tell your system where the Maven binaries are located so that you can run them from anywhere in the terminal.
To add the variables, open the terminal and enter the following command:
sudo nano /etc/profile.d/maven.sh
This will open a new file in the nano text editor. Add the following lines to the file:
export M2_HOME=/opt/apache-maven-3.8.1
export PATH=$M2_HOME/bin:$PATH
Save the file and exit the editor.
To make the changes to the environment variables take effect, you need to reload the file using the following command:
source /etc/profile.d/maven.sh
To verify that Apache Maven has been installed correctly, open the terminal and enter the following command:
mvn -version
This should display the version of Apache Maven that you have installed, along with some additional information.
Congratulations! You have successfully installed Apache Maven on your OpenSUSE system. You can now use Maven to build and manage your Java projects.
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!