How to configure Maven in Jenkins

0 votes

Hi Guys,

I have installed Maven in my RHEL system. Now I want to configure Maven in Jenkins. Can anyone help me how can I do this?

Jun 4, 2020 in DevOps & Agile by akhtar
• 38,210 points

2 answers to this question.

0 votes


You have to configured Maven and Java in your local system where your Jenkins server is running. You can go the below given link.

Now configure Maven in your Jenkins master node. Follow the below given steps.

  • Go to manage jenkins->Global tool configuration

  • Click on JDK installation and set JAVA_HOME.

  • Click on Maven Installation and set Maven path.

  • Finally click on save and your Maven configuration is done.

answered Jun 4, 2020 by MD
• 95,300 points
0 votes


How to configure Maven in Jenkins-


I. Configure Maven in Jenkins

1. Go to Jenkins Dashboard ->Manage Jenkins ->Manage plugins ->Available ->Maven Integration ->Install

2. Go to Manage Jenkins->Global tool configuration->Maven -> Add Maven_home variable value (i.e. path of the maven file on your system).

3. Go to Jenkins Dashboard -> New Item -> Maven Project option will be available

II. Build a Maven project

  1. Go to Jenkins Dashboard -> New Item -> Choose name for the Maven Project (e.g. MyFirstMavenExample)

Image for post

2. On Configure Page, set the following:

a). Discard Old builds

Days to keep builds: 1

Max of builds to keep: 5

Image for post

b). JDK (to be used for this project) Java-1.8

c). Build -> adavanced -> enable the following

- Resolve Dependencies during Pom parsing

- Use custom workspace (add path of the folder containing pom.xml)

-Goals & Options = Clean Compile Test

Image for post

3). Apply & Save

4). Go to Project Window and Click ‘Build Now’.

*Error : Compilation error - No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?Probable cause: not able to connect to/find jdk.Solution:1.    Go to Jenkins dashboard -> Manage Jenkins -> Configure System -> Global properties -> Add Environment Variable :JAVA_HOME and value2.    Also check in the system of your windows :System -> advanced settings -> environment variablesSet the PATH : Append with the folder path of the jdkIf, user variable is pointing towards JRE, then update it to point towards java path.
answered Jul 14, 2020 by anonymous

edited Jul 15, 2020 by Sirajul

Related Questions In DevOps & Agile

0 votes
2 answers

How to configure Prometheus server in linux?

Hi there , Setup Prometheus Configuration All the prometheus ...READ MORE

answered Jul 9, 2020 in DevOps & Agile by Suhana
• 340 points
0 votes
1 answer
0 votes
1 answer

How to simplify or automate task group creation in TFS?

You can easily import or export task ...READ MORE

answered Apr 25, 2018 in DevOps & Agile by ajs3033
• 7,280 points
0 votes
1 answer

How to disable auto-restart task in TeamCity

There is a parameter which can be ...READ MORE

answered Apr 29, 2018 in DevOps & Agile by DareDev
• 6,890 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

How to configure maven in CentOS/ RHEL system?

Hi@akhtar, You can follow the below given steps ...READ MORE

answered Jun 3, 2020 in DevOps & Agile by MD
• 95,300 points
0 votes
1 answer

what is api token in jenkins and how to use for github webhook

Hi@Anil, GitHub webhook is used to trigger jenkins ...READ MORE

answered May 27, 2020 in DevOps & Agile by MD
• 95,300 points