gpt4 book ai didi

java - JaCoCo 报告在 Jenkins : java. lang.ArrayIndexOutOfBoundsException 中失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:45:04 25 4
gpt4 key购买 nike

我一直在本地使用 JaCoCo 没有问题。

在远程服务器上运行 Jenkins 作业时,作业构建良好并生成 JaCoCo 覆盖率报告(即它出现在我的 workspace/report 文件夹中)但在尝试发布报告时构建失败在 Jenkins 上。

我正在使用 Jenkins 1.460 和 JaCoCo 5.0.0。

我已经为 Jenkins 配置了:

  • exec 文件的路径:**/**.exec
  • 类路径:**/dist/validation/WEB-INF/classes
  • 源路径:**/src(我也尝试过**/Validation/src,并明确包含**/**.class 并排除其他文件类型)

这是配置问题还是兼容性错误?

[编辑:如果它能帮助其他人,其他论坛说 JaCoCo 需要 ASM 5.+ 来管理 Java 8 类分析。我已经在使用 ASM 5.0.1。]

BUILD SUCCESSFUL
Total time: 4 minutes 57 seconds
Archiving artifacts
Recording test results
[JaCoCo plugin] Collecting JaCoCo coverage data...
[JaCoCo plugin] **/**.exec;**/dist/validation/WEB-INF/classes;**/Validation/src; locations are configured
[JaCoCo plugin] Number of found exec files for pattern **/**.exec: 1
[JaCoCo plugin] Saving matched execfiles: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\jacoco.exec
[JaCoCo plugin] Saving matched class directories for class-pattern: **/dist/validation/WEB-INF/classes: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\dist\validation\WEB-INF\classes
[JaCoCo plugin] Saving matched source directories for source-pattern: **/Validation/src: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\src
[JaCoCo plugin] Loading inclusions files..
[JaCoCo plugin] inclusions: []
[JaCoCo plugin] exclusions: []
ERROR: Publisher hudson.plugins.jacoco.JacocoPublisher aborted due to exception
java.io.IOException: Error while analyzing class E:\Jenkins\jobs\Validation - Test Cases\builds\2015-02-23_15-59-44\jacoco\classes\org\gosh\validation\filters\ModifiedFileListFilter.class.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:150)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:144)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:175)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:208)
at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:126)
at hudson.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:133)
at hudson.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:102)
at hudson.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:291)
at hudson.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:273)
at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:371)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627)
at hudson.model.Run.run(Run.java:1446)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7
at org.jacoco.core.internal.analysis.MethodAnalyzer.addProbe(MethodAnalyzer.java:288)
at org.jacoco.core.internal.analysis.MethodAnalyzer.visitInsnWithProbe(MethodAnalyzer.java:224)
at org.jacoco.core.internal.flow.MethodProbesAdapter.visitInsn(MethodProbesAdapter.java:76)
at org.objectweb.asm.tree.InsnNode.accept(InsnNode.java:80)
at org.objectweb.asm.tree.InsnList.accept(InsnList.java:162)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:815)
at org.jacoco.core.internal.flow.ClassProbesAdapter$1.visitEnd(ClassProbesAdapter.java:124)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:107)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:142)
... 18 more
Finished: FAILURE

[更新 - 解决方案]

使用 this answer我在本地驱动器上安装了最近发布的 JaCoCo-0.7.4(参见 eclemma.org/jacoco)。此版本包含 issue 27088 的修复程序.我还必须删除并重新安装 Jenkins JaCoCo 插件(我使用的是 Jenkins 插件管理器)。

最佳答案

构建期间使用的 JaCoCo 版本与 Jenkins 在构建后操作中使用的版本之间似乎存在兼容性问题。

maven-jacoco-plugin 版本 0.7.3.201502191951 与 Jenkins JaCoCo 插件版本 1.0.18 相结合会导致此问题。 maven-jacoco-plugin 的版本 0.7.2.201409121644 似乎是兼容的。

另见 https://issues.jenkins-ci.org/browse/JENKINS-27088https://github.com/jenkinsci/jacoco-plugin/pull/51

关于java - JaCoCo 报告在 Jenkins : java. lang.ArrayIndexOutOfBoundsException 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28678591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com