Cannot run program “gradle” in Jenkins

原创 2016年07月22日 11:15:11

http://androidren.com/index.php?qa=396&qa_1=cannot-run-program-gradle-in-jenkins

持续集成时,刚配置为,新建job以后,运行遇到类似下面的错误:

[workspace] $ gradle clean -b build/build.gradle

FATAL: command execution failed

java.io.IOException: Cannot run program "gradle" (in directory "/Users/Shared/Jenkins/Home/jobs/test/workspace"): 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)

    at hudson.Launcher$LocalLauncher.launch(Launcher.java:707)

    at hudson.Launcher$ProcStarter.start(Launcher.java:338)

    at hudson.Launcher$ProcStarter.join(Launcher.java:345)

    at hudson.plugins.gradle.Gradle.performTask(Gradle.java:201)

    at hudson.plugins.gradle.Gradle.perform(Gradle.java:97)

    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)

    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:695)

    at hudson.model.Build$RunnerImpl.build(Build.java:178)

    at hudson.model.Build$RunnerImpl.doRun(Build.java:139)

    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)

    at hudson.model.Run.run(Run.java:1404)

    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)

    at hudson.model.ResourceController.execute(ResourceController.java:88)

    at hudson.model.Executor.run(Executor.java:238)

Caused by: java.io.IOException: error=2, No such file or directory

    at java.lang.UNIXProcess.forkAndExec(Native Method)

    at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)

    at java.lang.ProcessImpl.start(ProcessImpl.java:91)

    at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)

    ... 16 more

Build step 'Invoke Gradle script' changed build result to FAILURE

Build step 'Invoke Gradle script' marked build as failure

Finished: FAILURE

 

解决:

这个gradle的配置不对。进入项目的详情页,点击设置,找到“构建”那里的Invoke Gradle script,设置为:Use Gradle Wrapper,然后task里输入build。最后保存。


Jenkins中配置gradle项目的坑

今天在jenkins配置gradle项目时遇到一个奇特的问题记录如下: 问题在jenkins配置gradle项目如下所示:我的目的是想执行gradle clean build run任务,但是构建的时...
  • qhshiniba
  • qhshiniba
  • 2015-04-13 18:38:55
  • 27702

Gradle时Execute failed: java.io.IOException: Cannot run program "sdk-linux/build-tools/22.0.0/aapt"

使用Gradle build时出现Execute failed: java.io.IOException: Cannot run program "/usr/local/android-sdk-l...
  • xlyrh
  • xlyrh
  • 2017-01-22 11:57:10
  • 561

cannot run program "git.exe":CreateProcess error=2

在使用android studio从git上check项目的时候报错cannot run program "git.exe":CreateProcess error=2 请检查下面步骤: 1....
  • jiguangcanhen
  • jiguangcanhen
  • 2014-08-13 15:11:50
  • 26218

Execute failed: java.io.IOException: Cannot run program "sdk-linux/build-tools/22.0.0/aapt": error=2

在Linux上使用ant编译打包apk的时候,出现下面的错误及解决方法: 1、/usr/local/android-sdk-linux/tools/ant/build.xml:698: Execute...
  • catoop
  • catoop
  • 2015-07-30 22:18:15
  • 9717

切图异常: Cannot run program "gm": error=2, No such file or directory 处理

切图异常: Cannot run program “gm”: error=2, No such file or directory 处理使用im4java、ImageMagick/GraphicsMa...
  • chwshuang
  • chwshuang
  • 2017-08-15 15:30:19
  • 2717

PyCharm:Error running xxx: Cannot run program "D:\Python27\python.exe"

使用PyCharm运行程序时,出现Error running xxx: Cannot run program "D:\Python27\python.exe"这样的错误(xxx是你的项目名称),说明...
  • LAN_Randall
  • LAN_Randall
  • 2017-10-16 14:22:56
  • 2382

hudson运行出现java.io.IOException Cannot run program的错误分析

作者:朱金灿来源:http://blog.csdn.net/clever101       在昨天运行每日构建时hudson突然出错,错误信息如下:[MySoft3.1] $ cmd /c call ...
  • clever101
  • clever101
  • 2016-12-13 16:24:25
  • 3019

java.io.IOException: Cannot run program "chmod": CreateProcess error=2

在eclipse下运行mapreduce程序的时候报这个错误。 Exception in thread "main" java.io.IOException: Cannot run program ...
  • sinoyang
  • sinoyang
  • 2012-09-24 10:58:57
  • 7061

eclipse 本地工程单元测试出现can not run program"XXXX/javaw.exe" error=87

报这个错有2个解决方法: 1. 修改长路径:http://www.myexception.cn/ruby-rails/439356.html 当eclipse控制台报出Cannot r...
  • cp1820957097
  • cp1820957097
  • 2015-03-23 12:48:46
  • 1084

IntelliJ IDEA-从SVN导出项目出现:Cannot run program "svn"的解决办法

解决办法: 参考:http://blog.csdn.net/jxctx/article/details/41720343
  • ZHOU_VIP
  • ZHOU_VIP
  • 2017-05-12 10:12:37
  • 2672
收藏助手
不良信息举报
您举报文章:Cannot run program “gradle” in Jenkins
举报原因:
原因补充:

(最多只允许输入30个字)