因此,有效的代码如下:
UUID uuid = UUID.randomUUID()println('Random UUID: ' + uuid)multibranchPipelineJob('test') { configure { it / sources / 'data' / 'jenkins.branch.BranchSource' << { source(class: 'jenkins.plugins.git.GitSCMSource') { id(uuid) remote('...') credentialsId('...') includes('*') excludes('') ignoreonPushNotifications('false') traits { 'jenkins.plugins.git.traits.BranchDiscoveryTrait'() } } strategy(class: 'jenkins.branch.NamedExceptionsBranchPropertyStrategy') { defaultProperties(class: 'empty-list') namedExceptions(class: 'java.util.Arrays$ArrayList') { a(class: 'jenkins.branch.NamedExceptionsBranchPropertyStrategy$Named-array') { 'jenkins.branch.NamedExceptionsBranchPropertyStrategy_-Named'() { props(class: 'java.util.Arrays$ArrayList') { a(class: 'jenkins.branch.BranchProperty-array') { 'jenkins.branch.NoTriggerBranchProperty'() } } name('master') } } } } } }}


