我有一个jenkins构建,需要获取在变更集中签入的所有文件的文件名。
我在从机上安装了groovy,并配置Jenkins使用它。我正在运行下面的脚本,该脚本应返回名称(或者我认为这也可能是错误的),并打印到控制台屏幕,但我遇到了此错误:
groovy.lang.MissingPropertyException: No such property: paths for class: hudson.plugins.tfs.model.ChangeSet
下面是Groovy系统脚本:
import hudson.plugins.tfs.model.ChangeSet
// work with current build
def build = Thread.currentThread()?.executable
// get ChangesSets with all changed items
def changeSet= build.getChangeSet()
def items = changeSet.getItems()
def affectedFiles = items.collect { it.paths }
// get file names
def fileNames = affectedFiles.flatten().findResults
fileNames.each {
println "Item: $it" // `it` is an implicit parameter corresponding to the current element
}
我对Groovy和Jenkins非常陌生,所以如果它的语法有问题或者我遗漏了一个步骤,请告诉我。