Gradle JaCoCo Incompatible version 1006

摘要: A Gradle build + JaCoCo coverage report.

A Gradle build + JaCoCo coverage report.

build.gradle
    apply plugin: 'java'
    apply plugin: 'eclipse-wtp'
    apply plugin: 'jacoco' //code coverage
    repositories {
        mavenLocal()
        mavenCentral()
    jacoco {
        toolVersion = "0.7.5+"
    jacocoTestReport {
	    reports {
		  html.enabled = true
		  xml.enabled = true
		  csv.enabled = false

P.S Tested with Gradle 2.10

1. Problem

1.1 Run the jacocoTestReport task and hits the following error message :

$ gradle jacocoTestReport

Output

* What went wrong:
Execution failed for task ':jacocoTestReport'.
> Unable to read execution data file /home/mkyong/workspace/hc/analyzer/build/jacoco/test.exec

1.2 Get more info with --stacktrace option.

$ gradle jacocoTestReport --stacktrace

Output – java.io.IOException: Incompatible version 1006.

Caused by: : Unable to read execution data file /home/mkyong/workspace/hc/analyzer/build/jacoco/test.exec
	at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:516)
	at org.jacoco.ant.ReportTask.execute(ReportTask.java:490)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:78)
	//...
Caused by: java.io.IOException: Incompatible version 1006.
	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.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:59)
	at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:514)

2. Solution

Look like Gradle JaCoCo plugin is not compatible with JaCoCo 0.7.5, to fix it, downgrade JaCoCo to version 0.7.4+

build.gradle
    jacoco {
        toolVersion = "0.7.4+"

For similar “Incompatible version 100x” error, try downgrading or upgrade the JaCoCo version.

References

  1. Gradle – The JaCoCo Plugin
  2. JaCoCo Java Code Coverage Library
  3. StackOverlow – JaCoCo SonarQube incompatible version 1007

上一篇: How to use Gradle Wrapper
下一篇: Java RMI Hello World example
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号