Skip to content Skip to sidebar Skip to footer

Script.sh: Line 1: ./gradlew: No Such File Or Directory On Jenkins

This is error message I got ./gradlew clean assembleRelease /Users/bhanukaisuru/.jenkins/workspace/OrelGo@tmp/durable-b74adbad/script.sh: line 1: ./gradlew: No such file or di

Solution 1:

You do not need to specify the Jenkins workspace with the commands sh and bat if you want to execute a command on the root level of it.

sh 'mkdir test' would create a folder in <jenkins_workspace>/test for example.

If gradlew is located on the root of the Jenkins workspace the following should be sufficent:

sh "gradlew clean assembleRelease"

otherwise a full path works as well.

Solution 2:

You should CD to where your gradlew binary folder is, or using full path of the gradlew. because the command you run is executed in epemeral directory, not in the jenkins home. you can use ${JENKINS_HOME} to use the path of your jenkins home

Post a Comment for "Script.sh: Line 1: ./gradlew: No Such File Or Directory On Jenkins"