JaCoCo SonarQube incompatible version 1007

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] Analysing /mySuperProject/target/jacoco.exec -> java.io.IOException: Incompatible version 1007

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)

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)));
}

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?


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

e.g.

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.


What I did was to specify the jacoco version in my maven project.

<jacoco-maven-plugin.version>0.7.4.201502262128</jacoco-maven-plugin.version>

    <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
    </plugin>

That fix my issue!