JaCoCo SonarQube 不兼容版本 1007 [英] JaCoCo SonarQube incompatible version 1007

查看:25
本文介绍了JaCoCo SonarQube 不兼容版本 1007的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SonarQube 进行代码质量控制,但突然无法分析原本可以通过的构建并失败.

I'm using SonarQube for code quality control and suddenly builds that would otherwise pass can't be analyzed and fails.

[INFO] [00:00:03.630] 分析/mySuperProject/target/jacoco.exec ->java.io.IOException:不兼容的版本 1007

[INFO] [00:00:03.630] Analysing /mySuperProject/target/jacoco.exec -> java.io.IOException: Incompatible version 1007

当我使用调试开关调用 maven build 时,这个原因就暴露出来了

When I invoke maven build with debug switch, this cause is revealed

Caused by: java.io.IOException: Incompatible version 1007.
at org.jacoco.core.data.ExecutionDataReader.readHeader(ExecutionDataReader.java:127)
at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:107)
at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:87)
at org.sonar.plugins.jacoco.AbstractAnalyzer.readExecutionData(AbstractAnalyzer.java:134)
at org.sonar.plugins.jacoco.AbstractAnalyzer.analyse(AbstractAnalyzer.java:107)

在检查 jacoco ExecutionDataReader 时,我发现从

While inspecting jacoco ExecutionDataReader, I found that exception is thrown from

if (version != ExecutionDataWriter.FORMAT_VERSION) {
    throw new IOException(format("Incompatible version %x.",Integer.valueOf(version)));
}

从 ExecutionDataWriter 我发现了

and from ExecutionDataWriter I've found out

/** File format version, will be incremented for each incompatible change. */
public static final char FORMAT_VERSION = 0x1007;

这个不兼容的变化是什么?为什么会这样?任何想法如何解决这个挑战?

What is this incompatible change and why does it happen? Any ideas how to fix this challenge?

推荐答案

如前所述,这是由于 JaCoCo maven 插件代码中断.您可以(临时)在 jenkins maven 命令中指定版本,例如:

As already mentioned, this is due to a break in JaCoCo maven plugin code. You can (temporarily) specify the version in your jenkins maven command like:

clean org.jacoco:jacoco-maven-plugin:<version>:prepare-agent install

例如

clean org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent install

这是对我们有帮助的解决方法.但和大多数人一样,我仍在等待修复.

This was the workaround that helped us. But like most people, I'm still waiting for the fix to come.

这篇关于JaCoCo SonarQube 不兼容版本 1007的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆