Groovy   发布时间:2022-04-12  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了哈德森* .groovy在jenkins找不到大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用groovy脚本配置jenkins作业,我不知道我在配置上做错了什么我甚至无法执行简单的groovy命令

println System.getenv("PATH")

jenkins尝试构建时,它会显示以下堆栈跟踪,然后抛出以下错误

[workspace] $groovy "C:\Program Files (x86)\jenkins\jobs\{Project_name}\workspace\hudson2392295018240496017.groovy" 
The system cAnnot find the file specified
FATAL: command execution Failed
java.io.IOException: CAnnot run program "groovy" (in directory "C:\Program Files (x86)\jenkins\jobs\{Project_name}\workspace"): CreateProcess error=2,The system cAnnot find the file specified
    at java.lang.ProcessBuilder.start(UnkNown sourcE)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
    at hudson.Launcher$ProcStarter.start(Launcher.java:360)
    at hudson.Launcher$ProcStarter.join(Launcher.java:367)
    at hudson.plugins.groovy.Groovy.perform(Groovy.java:110)
    at hudson.tasks.buildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
    at hudson.model.build$BuildExecution.build(Build.java:199)
    at hudson.model.build$BuildExecution.doRun(Build.java:160)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.resourceController.execute(resourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Caused by: java.io.IOException: CreateProcess error=2,The system cAnnot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(UnkNown sourcE)
    at java.lang.ProcessImpl.start(UnkNown sourcE)
    ... 16 more
Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE

我在jenkins配置中使用认的groovy版本,并为groovy安装了jenkins插件.

我是jenkins和groovy的新手.
提前致谢.

解决方法

需要安装一个你的jenkins可以看到的Groovy – 这是认选项

或者,您可以在全局配置中@L_674_16@一个

然后可以在构建步骤中使用它

Started by user anonymous
Building in workspace /Users/xxxxxx/.jenkins/jobs/gr/workspace
[workspace] $groovy /Users/xxxxx/.jenkins/jobs/gr/workspace/hudson5419917819864291744.groovy
build
/Users/xxxxxx/perl5/perlbrew/bin:/Users/xxxxx/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Finished: succesS

大佬总结

以上是大佬教程为你收集整理的哈德森* .groovy在jenkins找不到全部内容,希望文章能够帮你解决哈德森* .groovy在jenkins找不到所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。