Gradle JaCoCo - несовместимая версия 1006
Отчет о покрытии Gradle build + JaCoCo.
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. проблема
1.1 Run the jacocoTestReport task and hits the following error message :
$ gradle jacocoTestReport
Выход
* What went wrong: Execution failed for task ':jacocoTestReport'. > Unable to read execution data file /home/example/workspace/hc/analyzer/build/jacoco/test.exec
1.2 Get more info with --stacktrace option.
$ gradle jacocoTestReport --stacktrace
Выход -java.io.IOException: Incompatible version 1006.с
Caused by: : Unable to read execution data file /home/example/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. Решение
Похоже, плагин Gradle JaCoCo несовместим с JaCoCo0.7.5, чтобы исправить это, понизьте JaCoCo до версии0.7.4+
build.gradle
jacoco {
toolVersion = "0.7.4+"
}
Для аналогичной ошибки «Несовместимая версия 100x» попробуйте понизить версию или обновить версию JaCoCo.