forlong401的专栏--有问题上:http://www.androidren.com

Android and iOS Now! 多交流技术,多分享,技术只有分享,才会经久不衰。 欢迎关注新浪微博:@forlong401 。http://weibo.com/forlong401...

Cannot run program “gradle” in Jenkins

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
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭