我们在每次提交后都在jenkins上运行一个findbug作业,其结果由静态分析插件发布。 这通常完全按预期工作,但有时(大约每100个构建一次)findbugs以退出代码137退出。当它这样做时,它也会生成一个完全空的findbugs.xml文件
空的xml文件导致静态分析插件认为这个版本非常棒(没有错误)并将其用作新的引用构建,这反过来使得每个构建都失败/不稳定。
我真的找不到任何有用的退出代码应该是什么意思,或者如何防止它。 我正在寻找一种方法来阻止此exitcode 137的出现或获取静态分析插件将此构建视为失败(而不是新的引用构建)
我也想知道这段代码的实际意义。
使用exitcode 137的作业控制台输出(作业:#1957,报告没有错误)
--- snip -- more applying of bugpatterns--
[findbugs] Applying edu.umd.cs.findbugs.detect.MultithreadedInstanceAccess to nl/base/rela/entities/relagroups/RelationGroup$1
[findbugs] Applying edu.umd.cs.findbugs.detect.BadUseOfReturnValue to nl/base/rela/entities/relagroups/RelationGroup$1
[findbugs] Applying edu.umd.cs.findbugs.detect.MethodReturnCheck to nl/base/rela/entities/relagroups/RelationGroup$1
[findbugs] Applying edu.umd.cs.findbugs.detect.IDivResultCastToDouble to nl/base/rela/entities/relagroups/RelationGroup$1
[findbugs] Applying edu.umd.cs.findbugs.detect.FindBadCast2 to nl/base/rela/entities/relagroups/RelationGroup$1
[findbugs] Java Result: 137
[findbugs] Output saved to findbugs.xml
BUILD SUCCESSFUL
Total time: 9 minutes 0 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Skipping file of module /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml because it's empty.
[FINDBUGS] Computing warning deltas based on reference build #1956
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1956
Archiving artifacts
上一个作业的控制台输出(作业:#1956,报告现有错误):
---snip---
[findbugs] Applying edu.umd.cs.findbugs.detect.AtomicityProblem to nl/base/rela/entities/Project$1
[findbugs] Applying edu.umd.cs.findbugs.detect.DefaultEncodingDetector to nl/base/rela/entities/Project$1
[findbugs] 32 usecs/byte 29 msec 898 bytes 1 pass nl/base/rela/entities/Project$1
[findbugs] Analysis completed
[findbugs] Warnings generated: 770
[findbugs] Calculating exit code...
[findbugs] Setting 'bugs found' flag (1)
[findbugs] Exit code set to: 1
[findbugs] Java Result: 1
[findbugs] Output saved to findbugs.xml
BUILD SUCCESSFUL
Total time: 9 minutes 30 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Successfully parsed file /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml of module with 770 warnings.
[FINDBUGS] Computing warning deltas based on reference build #1955
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1955
Archiving artifacts
答案 0 :(得分:2)
作为解决方法,添加运行脚本的buld步骤,该脚本检查findbugs.xml文件是否为空,如果是,则返回非零退出代码,构建失败
可选:查看插件,自行修复,提交补丁