【问题标题】:Jenkins/Groovy: How to pass named parameters and closures to the same method?Jenkins/Groovy:如何将命名参数和闭包传递给同一个方法?
【发布时间】:2019-08-09 14:33:07
【问题描述】:

我有一个带有这个签名的共享库方法:

call(Map kwargs, String image_name, String version, Closure closure)

我这样称呼它:

dockerBuildWith("go-build", "latest", image_context: "build", 
                changesets: ["build/Dockerfile"]) {
  ...
}

但是我收到了这个错误:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: 没有方法签名: dockerBuildWith.call() 适用于参数类型: (java.util.LinkedHashMap, java.lang.String, java.lang.String, org.jenkinsci.plugins.workflow.cps.CpsClosure2) 值:[[image_context:build, changesets:[build/Dockerfile]], go-build, ...]

可能的解决方案:call(java.lang.String, java.lang.String, groovy.lang.Closure), wait(), any(), run(), run(), dump()

【问题讨论】:

    标签: jenkins groovy


    【解决方案1】:

    我忘了把def 放在call() 定义前面。

    【讨论】:

      猜你喜欢
      • 2015-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-19
      • 2012-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多