jenkins job dsl - 没有方法签名:java.lang.String.call()
jenkins job dsl - No signature of method: java.lang.String.call()
我无法运行这段代码:
buildPath = 'applications'
buildJob(['java', 'nodejs'])
def buildJob(def jobList){
for(job in jobList){
def jobName = "${job}_seed"
def jobDescription = "Jenkins DSL seed for ${job}"
def jobScriptPath = "resources/dsl/${jobName}.groovy"
job("${buildPath}/${jobName}")
}
}
所以,我收到了这个错误:
Processing provided DSL script
ERROR: (script, line 12) No signature of method: java.lang.String.call() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [applications/java_seed]
Possible solutions: wait(), any(), wait(long), take(int), each(groovy.lang.Closure), any(groovy.lang.Closure)
Finished: FAILURE
我看不到导致此错误的位置或原因。我在 buildJob(def jobList)
函数之外创建了一个作业,它正在运行,但我需要执行循环以自动创建作业。
有什么想法吗?
您正在以下行中迭代字符串数组:
for(job in jobList){
并为此使用变量 job
。
然后您尝试对该变量调用方法 call
:
job("${buildPath}/${jobName}")
发布一个我 运行 遇到的类似问题。网上关于这个问题的讨论不多。
No signature of method: java.lang.String.call() is applicable for argument types: (java.lang.String) values: [some-value]
假设我们正在实施一个作业 dsl 插件 (https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin),例如:
includeRegionBranchBuildStrategy {
includedRegions(String value)
}
我们有这样的代码:
def includedRegions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(includedRegions){
includeRegionBranchBuildStrategy {
includedRegions(includedRegions)
}
}
}
}
}
需要重命名您的变量才能使其正常工作!例如,该方法不能与上面定义的 var 同名。
def regions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(regions){
includeRegionBranchBuildStrategy {
includedRegions(regions)
}
}
}
}
}
我无法运行这段代码:
buildPath = 'applications'
buildJob(['java', 'nodejs'])
def buildJob(def jobList){
for(job in jobList){
def jobName = "${job}_seed"
def jobDescription = "Jenkins DSL seed for ${job}"
def jobScriptPath = "resources/dsl/${jobName}.groovy"
job("${buildPath}/${jobName}")
}
}
所以,我收到了这个错误:
Processing provided DSL script
ERROR: (script, line 12) No signature of method: java.lang.String.call() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [applications/java_seed]
Possible solutions: wait(), any(), wait(long), take(int), each(groovy.lang.Closure), any(groovy.lang.Closure)
Finished: FAILURE
我看不到导致此错误的位置或原因。我在 buildJob(def jobList)
函数之外创建了一个作业,它正在运行,但我需要执行循环以自动创建作业。
有什么想法吗?
您正在以下行中迭代字符串数组:
for(job in jobList){
并为此使用变量 job
。
然后您尝试对该变量调用方法 call
:
job("${buildPath}/${jobName}")
发布一个我 运行 遇到的类似问题。网上关于这个问题的讨论不多。
No signature of method: java.lang.String.call() is applicable for argument types: (java.lang.String) values: [some-value]
假设我们正在实施一个作业 dsl 插件 (https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin),例如:
includeRegionBranchBuildStrategy {
includedRegions(String value)
}
我们有这样的代码:
def includedRegions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(includedRegions){
includeRegionBranchBuildStrategy {
includedRegions(includedRegions)
}
}
}
}
}
需要重命名您的变量才能使其正常工作!例如,该方法不能与上面定义的 var 同名。
def regions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(regions){
includeRegionBranchBuildStrategy {
includedRegions(regions)
}
}
}
}
}