In order to build Maven projects in Jenkins, we have to configure the JDK in addition to the mandatory part, which is also mandatory for us to configure Apache Maven for Jenkins to use. So, in this tutorial, I will guide you all how to configure Apache Maven in Jenkins.
First, log in to your admin account, then go to Manage Jenkins, select Global Configuration Configuration, and go to the configuration section for Apache Maven. Here, we will have two parts to configure for Apache Maven:
The first part is the configuration section for Apache Maven about the settings.xml file.
You can select Use default maven settings for the Default settings provider section, Use default maven global settings for the Default global settings provider section to use the default Apache Maven configuration. Or you can click on the drop down of each section to select a different settings.xml file.
Enter the path to the settings.xml file in the File path.
Here, I will use the Apache Maven default settings.xml file so I will choose to use the Default …
The second part that we need to configure is the Maven installations.
Click the Add Maven button to configure this section.
By default, Jenkins allows us to install Apache Maven automatically using its latest version. You just need to add information about the name of this installation is okay. Click the Save or Apply button if you want to use this default configuration after entering the value for Name.
If you want to use Apache Maven that you have installed on your machine then uncheck Install automatically. Then, you need to enter MAVEN_HOME information as follows:
with Name is okay.
I will choose Install automatically for convenience. 🙂
At this point, you can click the Save or Apply button to complete the configuration.