gpt4 book ai didi

jenkins - 无法在 Jenkins 中运行程序 "gradle"

转载 作者:行者123 更新时间:2023-12-03 05:45:32 24 4
gpt4 key购买 nike

我已经为 Jenkins 安装了 Gradle 插件。当我尝试构建项目时,出现以下错误:

[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 clean -b build/build.gradle 可以按预期工作。

最佳答案

我遇到了同样的问题,发现对我来说问题是项目配置中的gradle版本。它被设置为默认,当我将其设置为 gradle 版本时,我在管理 Jenkins> 配置选项中的插件配置中指向,找到了gradle并且工作正常。

这是一个很难调试的问题,我希望这可以节省其他人的时间。

关于jenkins - 无法在 Jenkins 中运行程序 "gradle",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8646762/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com