RichardPrabhakar
RichardPrabhakar

Reputation: 11

Conflict between Global Jenkins Java_Home path and local Java_Home path in the remote system

In My Jenkins JAVA_HOME(Global Configuration) path has been configured to JAVA_HOME="D:\SRVAPP\jdk1.8.0_162"

In My remote PC JAVA_HOME path has been configured to JAVA_HOME="C:\SRVAPP\jdk-11.0.8" (as i dont have D drive in my remote PC)

Now i want to set the JAVA_Home path to JAVA_HOME="C:\SRVAPP\jdk-11.0.8" instead of JAVA_HOME="D:\SRVAPP\jdk1.8.0_162" in the Jenkins pipeline

Is it possible?

Upvotes: 1

Views: 1427

Answers (2)

Ian W
Ian W

Reputation: 4767

The Default location is set via ${JENKINS_URL}/configureTools: Global Tools config

You can override that on a per node basis via ${JENKINS_URL}/computer/${NODE}/configure: Node config

That value is used when selecting the JDK on the job level: JDK selector

If you are constrained in what you can do, you should generally be able to override this by using the env-inject plugin to inject a specific value, either in the "Build Environment" section or by adding a specific step:
ENV: Build env config


STEP: Build step config

However, your best best bet may be to use the "Global Configuration | Slave Setup", based on a given label to apply a configuration: enter image description here

Upvotes: 1

pitseeker
pitseeker

Reputation: 2563

Every Jenkins node (aka slave or remote like you call it) can define the locations for the globally configured tools. See the configure menu of your remote node and check the "Tools Locations" checkbox. Then click the button "Add" to define the location of your Java on that node.

Upvotes: 0

Related Questions