Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
groovy.lang.MissingMethodException:没有方法的签名:java.util.ArrayList_Java_Jenkins_Groovy_Jenkins Groovy - Fatal编程技术网

groovy.lang.MissingMethodException:没有方法的签名:java.util.ArrayList

groovy.lang.MissingMethodException:没有方法的签名:java.util.ArrayList,java,jenkins,groovy,jenkins-groovy,Java,Jenkins,Groovy,Jenkins Groovy,您好,我是groovy新手,我正在尝试使用jenkins获取tfs changset的编辑类型,但是,当尝试访问编辑类型时,我遇到以下错误: 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新手,我正在尝试使用jenkins获取tfs changset的编辑类型,但是,当尝试访问编辑类型时,我遇到以下错误:

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
认为它返回了一个无法打印的对象,但事实并非如此。

您调用的是集合上的方法,而不是底层类型。将其包装在for循环中,添加另一个
collect
或使用扩展点运算符(
*。
)调用该方法。e、 g

filez*.getEditType()

我认为您正在对集合而不是类型调用
getEditType()
。尝试将
*。
添加到您在
filez
@killjoy上的通话中这是一个正确的答案。你会把它作为将来可能遇到的任何人的答案吗?