Apache Maven is a powerful project management tool that is based on POM (project object model). Maven is a tool that can be used for building and managing any Java-based project. Maven contains XML files also referred to as pom.xml which include configuration details, project dependencies, and other data.
This article will show two different ways to install Apache Maven on openSUSE 15.1 and other versions of openSUSE .
I. Install Maven on openSUSE 15.1
Installation of Java: Updating the package index:
sudo zypper up
Install the OpenJDK package:
sudo zypper install java-11-openjdk-devel
- Verifying the Java installation:
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-suse-lp184.108.40.206-x8664)
OpenJDK 64-Bit Server VM (build 11.0.13+8-suse-lp220.127.116.11-x8664, mixed mode)
Apache Maven Download
- Download the stable version of Apache Maven and you can download it to the "/tmp" directory, as shown below:
sudo wget http://mirrors.advancedhosters.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
The file will be downloaded as a tar.gz file. You can extract files to /opt directory:
sudo tar -xvzf apache-maven-3.6.3-bin.tar.gz -C /opt
In order to have control of Maven versions and updates, we will create a symbolic link to Maven that points to the Maven installation directory. Run the below command:
sudo ln -s /opt/apache-maven-3.6.3 /opt/maven
- Move to the root path before setting up the environments for Maven:
Setup the Environment for Maven
You must configure a few environment variables, including JAVA_HOME, M3_HOME, and MAVEN_HOME.
- Create a new file named
sudo vi /etc/profile.d/maven.sh
The configuration below needs to be added to this newly created file:
Save and close the file.
Provide the required privileges to the file using the command below:
sudo chmod +x /etc/profile.d/maven.sh
- Load the environment variables using the
Verify the Maven installation
Use the command
mvn -versionwhich will print the Maven version:
Apache Maven 3.6.3 (SUSE 3.6.3-lp152.2.31)
Maven home: /usr/share/maven
Java version: 11.0.13, vendor: Oracle Corporation, runtime: /usr/lib64/jvm/java-11-openjdk-11
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.3.18-lp152.17-default", arch: "amd64", family: "unix"
Install Apache Maven using Zypper
- An easy and simple way to install maven using Zypper. Update the package index by using the following command,
sudo zypper up
sudo zypper install maven
- Verify the installation by running the