https://github.com/jenkinsci/extended-choice-parameter-plugin/pull/25 这个扩展选择参数的插件,发现不能像评论那样使用:
extendedChoice(
defaultValue: 'One,Two,Three,Four',
description: '',
multiSelectDelimiter: ',',
name: 'SAMPLE_EXTENDED_CHOICE',
quoteValue: false,
saveJSONParameterToFile: false,
type: 'PT_CHECKBOX',
value:'One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten',
visibleItemCount: 10)
我只能下面这样封装下后可以使用
def extendedChoice(Map params){
def visibleItemCount = params.visibleItemCount ?: params.values.split(',').size()
return new ExtendedChoiceParameterDefinition(
params.name, //name,
params.type, //type
params.value, //value
"", //projectName
"", //propertyFile
"", //groovyScript
"", //groovyScriptFile
"", //bindings
"", //groovyClasspath
"", //propertyKey
params.defaultValue, //defaultValue
"", //defaultPropertyFile
"", //defaultGroovyScript
"", //defaultGroovyScriptFile
"", //defaultBindings
"", //defaultGroovyClasspath
"", //defaultPropertyKey
"", //descriptionPropertyValue
"", //descriptionPropertyFile
"", //descriptionGroovyScript
"", //descriptionGroovyScriptFile
"", //descriptionBindings
"", //descriptionGroovyClasspath
"", //descriptionPropertyKey
"", //javascriptFile
"", //javascript
false, //saveJSONParameterToFile
false, //quoteValue
visibleItemCount, //visibleItemCount
params.description, //description
params.multiSelectDelimiter //multiSelectDelimiter
)
}
有没有啥两三行的传递,类似:
def extendedChoice(params){
return new ExtendedChoiceParameterDefinition(params)
}
我尝试了
def extendedChoice(Map params){
return new ExtendedChoiceParameterDefinition(params)
}
执行报错
java.lang.SecurityException: Unable to find constructor: new com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition java.util.LinkedHashMap