0

我正在尝试在与特定描述匹配的仓库中提取 CL 列表,但我没有成功。下面是我的代码和我得到的错误

 /* ALL MY IMPORTS */
 /* MY PERFORCE AND HTTP modules using grapes */

  /* SERVER LOGIN CONDITIONS */
List<IFileSpec> fileList = server.getDepotFiles(FileSpecBuilder.makeFileSpecList("//depot/release/prod/..."), false)
List<IChangelistSummary> changelistList = server.getChangelists(fileList,null)
def clList = [:]
def discl = []
if (changelistList != null) {
 changelistList.each { IChangelistSummary cl ->
    if (cl.getId() != null) {
        println cl.getId()
        IChangelist cld = server.getChangelist(cl.getId())
       println cld.getDescription()

     if(!(discl.contains(cl.getId())) && !(cl.getDescription().startsWith("Build with EF")) && !(cl.getUsername().matches("mb_ccatt")) ){
          discl << cl.getId
        clList.put(cl.getId(),cl.getUsername())
      }
   }
 }
}
   clList.each{ key,value ->
   println "\t$key: $value"
 }
 server.disconnect()

下面是日志,你可以看到,直到一定程度,所有的打印语句看起来都不错,然后突然抛出异常

    com.perforce.p4java.impl.generic.core.User@55322aab

我不明白它从哪里获取用户索引?

192359
Prod Copy Up using p4 copy from Dev-XXX to ZZZZ-Release using newly created label Dev-XXX.CCversion-XXX.20180212_103004.ICM730.COPY_UP_depot_mode

194118
Merging from ZZZZ-Release PARENT CL 194248   Yadav __ Description: 1802_UAT_Defect1234_Change

  com.perforce.p4java.impl.generic.core.User@55322aab
  Caught: groovy.lang.MissingPropertyException: No such property: getId for 
  class: com.perforce.p4java.impl.generic.core.ChangelistSummary
  groovy.lang.MissingPropertyException: No such property: getId for class: 
  com.perforce.p4java.impl.generic.core.ChangelistSummary
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
    at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
    at cllist_new$_run_closure1.doCall(cllist_new.groovy:34)
    at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    at groovy.lang.Closure.call(Closure.java:414)
    at groovy.lang.Closure.call(Closure.java:430)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
    at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at cllist_new.run(cllist_new.groovy:27)
    at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
    at groovy.lang.GroovyShell.run(GroovyShell.java:518)
    at groovy.lang.GroovyShell.run(GroovyShell.java:507)
    at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
    at groovy.ui.GroovyMain.run(GroovyMain.java:384)
    at groovy.ui.GroovyMain.process(GroovyMain.java:370)
    at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
    at groovy.ui.GroovyMain.main(GroovyMain.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
4

1 回答 1

1

我怀疑这里的问题是这getId是一个方法,而不是一个属性,所以你不能写:

discl << cl.getId

你必须写

discl << cl.getId()
于 2018-03-08T21:33:38.353 回答