![](/img/trans.png)
[英]Groovy script to execute multiple different job on jenkins without using pipeline?
[英]execute groovy script in jenkins job
我在詹金斯(Jenkins)中是個新手,我想在詹金斯(Jenkins)中運行groovy腳本'println“ hello world”'。 但我越來越錯誤。
[Test] $ groovy /var/jenkins_home/workspace /Test/hudson481621137087598172.groovy
FATAL: command execution failed
java.io.IOException: Cannot run program "groovy" (in directory "/var/jenkins_home/workspace/Test"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:935)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
at hudson.Launcher$ProcStarter.join(Launcher.java:465)
at hudson.plugins.groovy.Groovy.perform(Groovy.java:106)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1815)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
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:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 15 more
Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE
我在詹金斯(Jenkins)中找到了一些運行groovy腳本的解決方案,但是我不確定如何在我的情況下使用它。
在Jenkins中檢查全局工具配置之前,您可以嘗試安裝/更新Homebrew安裝並首先運行“ brew install groovy”。 這將使您能夠設置groovy主目錄路徑( http://macappstore.org/groovy/ )。 否則,Jenkins可能無法正確保存您的工具配置。
您應該設置GROOVY_HOME:
export GROOVY_HOME=/usr/local/opt/groovy/libexec
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.