UrbanCode udeploy运行Groovy脚本步骤中的NullPointerException

时间:2016-09-29 19:40:30

标签: groovy udeploy urbancode

同样的步骤运行了好几天,现在出现了这个错误。我也看到了与UCD 6.1.1相同的错误,然后代码能够在UCD 6.2.1中运行,但现在再次失败。可能是什么问题?

plugin: Groovy, id: com.urbancode.air.plugin.Groovy, version: 6
plugin command: 'cmd' '/C' '"f:\apps\yyyy\agent\opt\groovy-1.8.8\bin\groovy -cp "f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\classes;f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\lib\plugins-util.jar" f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\run_groovy_script.groovy F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props"'
working directory: F:\apps\yyyy\agent\var\work\XH70_Javascripts
properties:
  PLUGIN_INPUT_PROPS=F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props
  PLUGIN_OUTPUT_PROPS=F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props
  groovyHome=f:\apps\yyyy\agent\opt\groovy-1.8.8
  scriptBody=import groovy.io.FileType
def currentDir = new File('.')
def files = []
currentDir.eachFile(FileType.FILES) {
    if (it.name.endsWith(".zip")) {
        files << it.name - "-bin.zip"
    }
}

println files[0]
outProps.put("zipfilename", files[0])
environment:
  AGENT_HOME=f:\apps\yyyy\agent
  AH_AUTH_TOKEN=****
  AH_WEB_URL=https://ucd.com:8443
  AUTH_TOKEN=****
  CODESTATION_URL=https://ucd.com:20081
  CODESTATION_USE_PROXY=false
  DS_AUTH_TOKEN=****
  DS_SYSTEM_ENCODING=Cp437
  JAVA_OPTS=-Dfile.encoding=Cp437 -Dconsole.encoding=Cp437
  PLUGIN_HOME=f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e
  PROXY_HOST=ucd.com
  PROXY_PORT=20080
  UD_DIALOGUE_ID=b9521caf-6399-4455-a8e4-7e79bc3c95b2
  WE_ACTIVITY_ID=f819fba0-4800-4c87-9e29-5efa3698fe76
================================================================================

Running Groovy Script
command: f:\apps\yyyy\agent\opt\groovy-1.8.8\bin\groovy.bat C:\Windows\TEMP\groovy_script_8111838756530262064.groovy F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props
null
Caught: java.lang.NullPointerException
java.lang.NullPointerException
    at java_util_Map$put.call(Unknown Source)
    at groovy_script_8111838756530262064.run(groovy_script_8111838756530262064.groovy:26)
Caught: com.urbancode.air.ExitCodeException: Command failed with exit code: 1
com.urbancode.air.ExitCodeException: Command failed with exit code: 1
    at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:195)
    at com.urbancode.air.CommandHelper$runCommand$0.callCurrent(Unknown Source)
    at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:121)
    at com.urbancode.air.CommandHelper$runCommand.call(Unknown Source)
    at run_groovy_script.run(run_groovy_script.groovy:64)

1 个答案:

答案 0 :(得分:0)

可能currentDir.eachFile()没有返回任何文件,因此files[0]为空。