简体   繁体   English

哈德森将成功的Ant构建检测为失败

[英]Hudson detects a successful Ant build as a failure

My Hudson version is 1.249 (old, I know). 我的Hudson版本是1.249(我知道是旧的)。 Java version is 1.6.0_17. Java版本是1.6.0_17。 Ant version is 1.6.5. Ant版本是1.6.5。 Here's the Console Output from Hudson: 这是哈德森的控制台输出:

started
[workspace] $ "C:\Progs\GNU\WinCvs 1.3\cvs.exe" -q -z3 update -PdC -D "Thursday, February 10, 2011 8:56:43 AM UTC"
? bin
? pdfer.jar
P src/main/java/com/xxxxx/pdfer/Job.java
P src/main/java/com/xxxxx/pdfer/Manager.java
U src/main/java/com/xxxxx/pdfer/ManagerException.java
P src/main/java/com/xxxxx/pdfer/Queue.java
U src/main/java/com/xxxxx/pdfer/QueueException.java
P src/main/java/com/xxxxx/pdfer/ResultHandler.java
U src/main/java/com/xxxxx/pdfer/ResultHandlerException.java
P src/test/java/com/xxxxx/pdfer/JobTest.java
P src/test/java/com/xxxxx/pdfer/ManagerTest.java
$ computing changelog
[workspace] $ cmd.exe /C '"ant.bat && exit %%ERRORLEVEL%%"'
Buildfile: build.xml

build:
   [delete] Deleting directory C:\hudson\jobs\XXX-PDFer-PDFer\workspace\bin
    [mkdir] Created dir: C:\hudson\jobs\XXX-PDFer-PDFer\workspace\bin
    [javac] Compiling 11 source files to C:\hudson\jobs\XXX-PDFer-PDFer\workspace\bin
      [jar] Building jar: C:\hudson\jobs\XXX-PDFer-PDFer\workspace\pdfer.jar

BUILD SUCCESSFUL
Total time: 2 seconds
finished: FAILURE

Something to do with the exit status returned by Ant in the version I was using (6) as reported by another user here . 与其他用户在此处报告的我正在使用(6)的版本中Ant返回的退出状态有关。 I "solved" it by upgrading to version 8. 我通过升级到版本8来“解决”它。

Is the job set to do anything else after the build completion? 在构建完成后,该作业是否设置为可以执行其他任何操作? It could be that the failure message is related to the hudson job while the success relates to the ant build step. 失败消息可能与哈德逊工作有关,而成功消息与蚂蚁构建步骤有关。 It's possible there are other steps after the build, which are failing. 构建后可能还有其他步骤失败了。 If i were you I'd look at the project configuration page to confirm. 如果我是我,请查看项目配置页面进行确认。

Hudson/Jenkins looks at the exit status of the last command in the job. Hudson / Jenkins查看作业中最后一条命令的退出状态。 If you have other steps after ant, such as cleaning up temporary files, uninstalling, etc, you need to save the status of the build before doing that, then as your last step make sure you exit appropriately. 如果您在执行ant之后还有其他步骤,例如清理临时文件,卸载等,则需要在执行此操作之前保存构建状态,然后作为最后一步,请确保正确退出。

For example, for some of our jobs we have a final "summary" python script that greps the logs and exits with an appropriate exit code if there were failures in the build or test scripts. 例如,对于我们的某些工作,我们有一个最终的“摘要” python脚本,该脚本可以捕获日志并在构建或测试脚本失败时以适当的退出代码退出。 Running this as the very last step insures hudson reports the proper status, plus it lets us print a nice concise summary at the end of the job. 将其作为最后一步来运行,可确保hudson报告正确的状态,此外,它还使我们可以在工作结束时打印出简洁明了的摘要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM