In this post, we will show you how to install Apache Maven on OpenSUSE 15.2 / 15.1.
To manage projects done in Java, there is no better tool than Apache Maven. This fantastic tool, belonging to the Apache foundation, comes with predefined objectives to perform certain clearly defined tasks, such as code compilation and packaging.
There are many features that make Maven a great tool. However, the key is that Maven is ready for network use. In addition, its functions are made extensible by the ability to install plugins. Finally, Maven relies on the Project Object Model (POM) to describe the project, as well as its dependencies for later deployment.
Installing Apache Maven on OpenSUSE 15.2 / 15.1
Upgrade the system and install Java
It is always advisable to have the system updated. With this you will have security patches that help increase the stability of the system.
So let’s do it. Open a terminal session and run:
:~$ sudo zypper up
Once the system update is completed, we can now continue with the rest of the steps.
Apache Maven requires Java to run, so the next step is to install it:
:~$ sudo zypper in java-11-openjdk java-11-openjdk-devel
Then, check the installed version.
:~$ java --version openjdk 11.0.7 2020-04-14 OpenJDK Runtime Environment (build 11.0.7+10-suse-lp152.1.2-x8664) OpenJDK 64-Bit Server VM (build 11.0.7+10-suse-lp152.1.2-x8664, mixed mode)
So, we can continue.
Install Apache Maven on OpenSUSE 15.2 / 15.1
So the best way to get the latest version of Apache Maven on our OpenSUSE 15.2 / 15.1 is to download it directly.
So, let’s download it.
:~$ cd /tmp/ :~$ wget -c http://mirrors.advancedhosters.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
At the time of this post, the latest stable version is 3.6.3.
Then it’s time to unzip it and move it to another folder. Since I downloaded the ZIP file I unzipped it.
:~$ unzip apache-maven-3.6.3-bin.zip
And move it to /opt/
:~$ sudo mv apache-maven-3.6.3 /opt/maven
Once you have done this, you have to define the environment variables to be able to use it from the terminal as one more command.
So, create a configuration file using the nano text editor and add the following:
:~$ sudo nano /etc/profile.d/maven.sh
export M2_HOME=/opt/maven/ export M2=$M2_HOME/bin export PATH=$M2:$PATH
Save the changes and close the file.
Now, display the installed version using the mvn command.
:~$ mvn -v
This means that everything is fine and Apache Maven is ready for work.
Apache Maven is a necessary tool for the development of Java applications. Besides this, we have that OpenSUSE is more and more chosen as the main distribution by many developers. That is why today you have learned to install Apache Maven on OpenSUSE 15.2 / 15.1.
Also, you can read more post about OpenSUSE and Maven.
Please share this post and join our telegram channel.
When all is done, do not forget to load/reload profile `source /etc/profile.d/maven.sh`