繁体   English   中英

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

[英]groovy.lang.MissingPropertyException: No such property: script for class: groovy.lang.Binding

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

我使用了这里批准的这个解决方案: 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

我该如何解决?

先感谢您

您没有在行中定义script变量

def changeSet = script.currentBuild.changeSets[0]; 

您需要先定义它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM