groovy.lang.MissingMethodException: нет подписи метода: java.util.ArrayList - PullRequest
0 голосов
/ 25 апреля 2018

Привет, я новичок в groovy и пытаюсь получить тип редактирования tfs changset с помощью jenkins, однако при попытке получить доступ к типу редактирования я получаю эту ошибку:

13:17:50 groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.getEditType() is applicable for argument types: () values: []
13:17:50    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
13:17:50    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
13:17:50    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
13:17:50    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
13:17:50    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
13:17:50    at Script1.run(Script1.groovy:66)
13:17:50    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
13:17:50    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
13:17:50    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
13:17:50    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:343)
13:17:50    at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
13:17:50    at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
13:17:50    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
13:17:50    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
13:17:50    at hudson.model.Build$BuildExecution.build(Build.java:206)
13:17:50    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
13:17:50    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
13:17:50    at hudson.model.Run.execute(Run.java:1727)
13:17:50    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
13:17:50    at hudson.model.ResourceController.execute(ResourceController.java:97)
13:17:50    at hudson.model.Executor.run(Executor.java:429)

Строка, на которой происходит сбой:

// work with current build
def build = Thread.currentThread()?.executable

// get ChangesSets with all changed items
def changeSet = build.getChangeSet()
def items = changeSet.getItems()

println "Affected Files"
def filez = items.collect{
it.getAffectedFiles()
}
println filez

println "Edit Type"
def edittype = filez.getEditType()
println edittype

Я знаю, что это вопрос нуби, но я действительно запутался в происходящем. Я попытался позвонить .toString, думая, что он возвращает объект, который не может быть напечатан, однако это не так.

1 Ответ

0 голосов
/ 26 апреля 2018

Вы вызываете метод для коллекции вместо базового типа. Либо оберните его в цикл for, добавьте еще один collect, либо используйте оператор растягивания (*.) для вызова метода. например

filez*.getEditType()
...