groovy.lang.MissingPropertyException:没有此类属性:类groovy.lang.Binding的脚本

时间:2019-01-11 09:31:59

标签: jenkins groovy jenkins-pipeline

我正在尝试使用Jenkinsfile(常规脚本)获取提交者的电子邮件地址

我使用了这里认可的解决方案: https://stackoverflow.com/a/46648279/10899655

我的代码:

@Library('shared-libraries') _ 
pipeline{
  //my stages here

}
post { 
    always { 
        script { 
            def changeSet = script.currentBuild.changeSets[0]; 
            Set authors = []; 
            if (changeSet != null) { 
                for (change in changeSet.items) { 
                    authors.add(GetUserEmail{user=change.author}) 
                } 
            } 
        } 
    } 
}

但是我收到此错误消息:

Error when executing always post condition:
groovy.lang.MissingPropertyException: No such property: script for class: groovy.lang.Binding

我该如何解决?

提前谢谢

1 个答案:

答案 0 :(得分:0)

您没有在行中定义mHolder.ivItemImage.setImageResource(mThumbIds[4])变量

mHolder.ivItemImage.setImageResource(mThumbIds[position])

您需要先定义它。