11 C
Texas
angeloma
Senior Writer and partner

How to install Apache Maven on OpenSUSE 15.2 / 15.1?

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.

- Advertisement -

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

2.- Downloading and installing Apache Maven on OpenSUSE 15.2 / 15.1
1.- Downloading and installing Apache Maven on OpenSUSE 15.2 / 15.1

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

3.- Installing Apache maven on OpenSUSE 15.2 / 15.1
3.- Installing Apache maven on OpenSUSE 15.2 / 15.1

Save the changes and close the file.

Now, display the installed version using the mvn command.

:~$ mvn -v

4.- Apache Maven working
3.- Apache Maven working

This means that everything is fine and Apache Maven is ready for work.

Conclusion

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article