How to Configure and Integrate Maven in Jenkins? (original) (raw)

Last Updated : 23 Jul, 2025

Maven integration with Jenkins makes Java project development and deployment easier. Step-by-step instructions for integrating Maven with Jenkins are provided in this guide. You will discover how to set up Jenkins for Maven, manage project dependencies, automate builds, and enhance software delivery pipelines.

What Is Maven?

Maven is a powerful project management tool that is based on POM (project object model). It is used for project build, dependency, and documentation. It simplifies the build process like ANT. But it is too much more advanced than ANT. In short terms we can tell maven is a tool that can be used for building and managing any Java-based project. maven makes the day-to-day work of Java developers easier and generally helps with the comprehension of any Java-based project.

Different Types Of Ways to Configure Maven in Jenkins

Configuring Maven Using Jenkins Plugin

Follow the steps mentioned below to configure Maven using Jenkins UI.

**Step 1: Click on the "Manage Jenkins" option in the navigation menu, sidebar, or user dropdown, click on it. This will take you to the Jenkins configuration management page where you can access various settings and options for managing your Jenkins server.manage-jenkins

**Step 2: After clicking on "Manage Jenkins" in the Jenkins dashboard, you'll find a section or category called "Tools" within the management options.tools

**Step 3: Here we are choosing the version maven3.9.6 you can configure according to your requiurment.

maven396Configuring Maven Using Jenkins CLI

Follow the steps mentioned below to configure maven in jenkins using jenkins CLI

**Step 1: Using the below command, first verify whether the maven is installed or not.

mvn -v

In my instance, the error ****"command not found"** indicates that Maven is not installed, as you can see in the image. Rewrite the sentence

**Step 2: To install Maven within your Jenkins environment, use this command:

sudo apt install maven

mavn-using-jenkinscli

**Step 2: Once you've run the sudo apt install maven command, let's verify if the installation was successful.

mvn -v

mvninstalled

The image confirms successful Maven 3.8.7 installation using **sudo apt install maven.