I've configured a jenkins ubuntu slave and I want to run my gradle build on it(with gradle plugin). The problem is that when running the jenkins build job I get:
$ gradle --no-daemon --info clean build
FATAL: command execution failed
java.io.IOException: Cannot run program "gradle" (in directory "/var/jenkins/workspace/dadi"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
When running the same gradle command on the command line of the slave(same user) it runs successfully.
Found a workaround solution! I've start using gradle wrapper in order to run the gradle build. I did 2 things:
in jenkins gradle plugin marked the build step to use gradle wrapper.
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
This above line would create.gradle folder & download required gradle version(mentioned in the task) every time gradle build is run, that means there is no need to check-in .gradle folder into your repository anymore.
Also had to rename gradlew to gradle.bat since the jenkins gradle plugin try to run the gradle.bat even on linux. That's it. working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With