Indrajeet
Indrajeet

Reputation: 541

Make Jenkins slave recognize maven installation

I have configured Jenkins to install maven automatically on slaves when building the first time. This works when I run jobs that were created off of "Maven Project" templates. I just have to specify the goals and everything works.

enter image description here

It is with free-style software projects that I am having trouble with. How do I tell Jenkins to pass the path of installed maven to these jobs? For now, I am adding the maven path in the build section of the jobs.

I added the maven path to ~/.bashrc, ~/.bash_profile on the slave, but that didn't help either.

Upvotes: 2

Views: 3180

Answers (2)

Linh Kikuchi
Linh Kikuchi

Reputation: 21

You can actually add the Tools under "Tool Locations" and just choose the tool from the drop-down list that you added in Global Tool Configuration. I tested and it worked perfectly well with Maven Tool

Upvotes: 2

Technext
Technext

Reputation: 8107

It is in the Build section only that you define the Maven version. It provides you the flexibility to select different version for different projects. However, if you have only one version of Maven installed, then you simply have to make sure that it is present in the PATH variable. To set the same on any of the Jenkins' slave, just go to the slave's configuration page and add it in the path. You can refer the screenshot below for reference:

enter image description here

Upvotes: 5

Related Questions