Apache Maven is a project management tool for developing Java applications designed to provide a comprehensive and easy-to-read status of a project.
It also incorporates a POM (Project Object Model) approach, meaning that it uses standardized software libraries and plugins. These features help create a standard development environment for multiple teams.
This tutorial will walk you through installing Apache Maven on CentOS 7.
Access to a terminal window/command-line (Ctrl-Alt-F2)
The yum package manager, included by default
(Optional) The wget software utility
Option 1: Install Apache Maven on CentOS with Yum
1. Open a terminal window, and enter the following:
sudo yum install maven
Confirm the installation, and allow the process to complete. Maven should now be installed on your system.
2. Verify the installation by checking the Maven version:
The following output confirms a successful install:
Note: At the time this article was written, the latest stable version of Apache Maven was 3.6.0. If you need an older version, you can check Maven’s release history.
Option 2: Install Latest Version of Maven
Sometimes the software version in the default repositories is older than the latest stable release from the developers. This section will walk you through the manual installation of Apache Maven on CentOS.
Step 1: Install Java Development Kit
Apache Maven requires the Java Development Kit. This guide uses the OpenJDK software package.
1. In a terminal window, enter the following:
sudo yum install java-1.8.0-openjdk-devel
Allow the process to complete.
2. Verify the installation by checking the Java version:
Step 2: Download Apache Maven for CentOS
Download the Maven source file to the /tmp directory with the command:
To verify the installation of Apache Maven, use the command:
The system should display Apache Maven 3.6.0 and Maven Home: /opt/maven.
Using Apache Maven
Maven was designed initially for Java projects. However, it can also be used to build and manage other programming languages, such as Ruby and C#.
One of the ways that Maven works is through the use of plugins. Maven can download libraries and plugins from a central repository and cache a local version. Most plugins are written to support Java. If you’re planning to use Maven to manage another programming language, you may need to write your own plugins for that language.
Great job, you have successfully installed Apache Maven on CentOS 7.
Sofija Simic is an aspiring Technical Writer at phoenixNAP. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.