jenkins - java.io.IOException:无法运行程序“groovy”

时间:2016-08-19 15:07:01

标签: jenkins groovy

我在jenkins构建中有以下groovy脚本

def myFractureNO = ${FRACTURE_NO};
def myBuildNumber = ${BUILD_NUMBER};
def projectXml = new XmlSlurper().parseText("curl http://sparkbuilder.corp.adobe.com:8080/job/FractureAUT/api/xml".execute().text);
projectXml.build.each {
  if(it.number < myBuildNumber)
  {
      def jobXml = new XmlSlurper().parseText(("curl http://sparkbuilder.corp.adobe.com:8080/job/FractureAUT/" + it.number + "/api/xml").execute().text);

      if(1) {
        def myparams = jobXml.getAction(hudson.model.ParametersAction.class);
        for( p in myparams ) {
             if (p.name.toString == "FRACTURE_NO") {
                if (p.value.toString() == "$myFractureNO") {
                    println p.value.toString();
                }
            }
        }
      }
   }
}

我收到错误说

java.io.IOException: Cannot run program "groovy"

当jenkins尝试在Jenkins奴隶上运行此脚本时。我该如何解决这个问题?

现在,当我尝试将脚本作为系统脚本执行时,我收到以下错误

groovy.lang.MissingMethodException: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values [Script1$_run_closure1@5e38bed4]
Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)
at Script1.run(Script1.groovy:1)

1 个答案:

答案 0 :(得分:1)

以下是无效的groovy:

def myFractureNO = ${FRACTURE_NO};
def myBuildNumber = ${BUILD_NUMBER};

我猜你正试图从环境中获取一些变量。请参阅此相关问题:https://stackoverflow.com/a/26428580/172599