hudson * .groovy在jenkins中找不到 [英] hudson*.groovy not found in jenkins

查看:1095
本文介绍了hudson * .groovy在jenkins中找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用groovy脚本配置jenkins作业,我不知道我在做什么配置错误,即使是一个简单的groovy命令也不能执行,比如

 println System.getenv(PATH)

显示下面的堆栈跟踪,当詹金斯试图建立,然后跟随错误抛出

  [工作区] $ groovyC:\Program文件(x86)\Jenkins\jobs\ {} PROJECT_NAME \workspace\hudson2392295018240496017.groovy 
系统找不到指定
FATAL文件:命令执行失败
的Java。 io.IOException:无法运行程序groovy(在目录C:\ Program Files(x86)\Jenkins\jobs\ {Project_Name} \workspace):CreateProcess error = 2,系统找不到文件在java.lang.ProcessBuilder.start中指定
(未知源代码)$ h $ b $ $ hudson.Proc $ LocalProc。< init>(Proc.java:244)
at hudson.Proc $ LocalP ROC<初始化>(Proc.java:216)
。在hudson.Launcher $ LocalLauncher.launch(Launcher.java:780)
。在hudson.Launcher $ ProcStarter.start(Launcher.java:360 )
在hudson.Launcher $ ProcStarter.join(Launcher.java:367)
处hudson.tasks hudson.plugins.groovy.Groovy.perform(Groovy.java:110)
。 BuildStepMonitor $ 1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild $ AbstractBuildExecution.perform(AbstractBuild.java:772)
at hudson.model.Build $ BuildExecution.build(Build.java :199)
在hudson.model.Build $ BuildExecution.doRun(Build.java:160)
在hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:535)
。在hudson.model.Run.execute(Run.java:1732)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java: 88)
在hudson.model.Executor.run(Executor.java:234)
引起:java.io.IOException:CreateProcess错误= 2,系统无法在java.lang.ProcessImpl.create(Native Method)$ b $ java.lang.ProcessImpl找到指定
的文件。< init>(Unknown Source)
在java.lang.ProcessImpl.start(未知源代码)
... 16 more
构建步骤'执行Groovy脚本'标记构建失败
完成:FAILURE

我在jenkins配置中使用了默认的 groovy version ,并安装了jenkins插件对于groovy。



我对jenkins和groovy都很陌生。
在此先感谢。

解决方案

您需要安装Groovy,Jenkins可以看到 - 这是默认选项

或者,您可以在全局配置中添加一个




 由用户anonymous开始
在工作区中构建/Users/xxxxxx/.jenkins/jobs/gr/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
完成:SUCCESS


I am trying to configure jenkins job with groovy scripts, I donot know what I am doing wrong with the configuration that I could not execute even a simple groovy command like

println System.getenv("PATH")

it shows the following stack trace when the jenkins tries to build then following error is thrown

[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

I am using default groovy version in jenkins configuration and have installed the jenkins plugins for groovy.

I am new to both jenkins and groovy. Thanks in advance.

解决方案

You need to have an install of Groovy which your Jenkins can see - which is the default option

Alternatively, you can add one in the global config

which can then be used in the build step

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

这篇关于hudson * .groovy在jenkins中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆