Groovy阶段不接受java数组列表

tpxzln5u  于 2022-11-01  发布在  Java
关注(0)|答案(1)|浏览(258)

我尝试在groovy阶段引用一个列表,如下所示:

stage('Post Build Actions') {
  emailext subject: "(Status ${currentBuild.result})", to: (['test1@test.co.uk', 'test2@test.co.uk']), body: '$DEFAULT_CONTENT'
}

但是,这会产生错误:

class hudson.plugins.emailext.EmailExtStep.setTo() expects class java.lang.String but received class java.util.ArrayList

我能不能把它修好?

lstz6jyr

lstz6jyr1#

尝试

emailext subject: "(Status ${currentBuild.result})", to: 'test1@test.co.uk,test2@test.co.uk', body: '$DEFAULT_CONTENT'

也就是说,只需将它们放在一个字符串中,用逗号分隔它们

相关问题