3

I am trying to trigger gradle command in execute shell of a particular node from jenkins master and it's trowing an exception as-

gradle: command not found
Build step 'Execute shell' marked build as failure

However, gradle command works if am trying to execute shell in the same node itself under local workspace.

What I understood-

  • Triggering any job from remote by default try to search executable like 'adb', 'gradle' in /usr/local/bin of node machine (Macintosh)
  • read-write access should be there for '.gradle' folder

What I have done-

  • added .gradle inside /usr/local/bin of slave

  • granted read-write access to .gradle

Here, both node-jenkins and master-jenkins have gradle v2.5 installed. Why execute shell triggered from master jenkins not able to find gradle in slave jenkins, any help would be appreciated.

4 Answers 4

0

try run env before your try to run gradle. and compare it to env from the command line. I think that Jenkins use another path.

Sign up to request clarification or add additional context in comments.

1 Comment

gradle_home is not getting passed while triggering job in slave. However, the value for the same is set under bash_profile
0

I was also facing same issue where gradle command working fine on machine where jenkins is installed but the same command was not working on slave.

Solution:

  1. You need to set GRADLE_HOME on slave.
  2. Most important: set PATH into the slave configuration [copy the exact PATH path from slave machine and copy it into Jenkins slave configuration under Jenkins--> Manage Jenkins--> Manage Node--> NodeName(your node name)--> Configure and search for Node Properties-->Environment variables]
  3. save

Comments

0

In my case I have added additional PATH env variable, then it worked.

enter image description here

Comments

0

I was also facing same issue

  • verify you add Gradle Plugin to your jenkins
  • Verify that you inside the Folder where exist the "build.gradle" file

my example: the location of my gradle.build was insifr the foulder automation-api enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.