Cannot run program "gradle" in Jenkins Cannot run program "gradle" in Jenkins jenkins jenkins

Cannot run program "gradle" in Jenkins


I had the same issue and found that the problem for me was the gradle version in the project configuration. It was set to Default and when I set it to the gradle version I was pointing to in the plugin configuration in the Manage Jenkins > Configuration Options, It found gradle and worked properly.

This is a difficult issue to debug and I hope this saves someone else some time.


Solution Mastering_the_Object pointed out worked form me too, just to clarify steps there:
just installing Gradle plugin in Jenkins is not enough, you must also go to:
Jenkins->Manage Jenkins->Configure Jenkins->Configure system.
Under "Gradle Installations" type in name (it appears as version in project configuration), check "Install automatically" and select version. Then you can select that "Gradle version" in project configuration.


I was getting this error using the Gradle wrapper, was able to fix my broken build as follows:

  1. Go to Manage Jenkins -> Global Tool Configuration -> Gradle -> Add Gradle, give it a name
  2. Go to Jenkins -> (your job) -> Configure -> Build, choose "Invoke Gradle" and change the Gradle version from (Default) to the named version