We have migrated from ant
Build tool to Gradle and also upgraded 0.7.4
jacoco
version to latest 0.8.6
version.
I observed that the jacoco Reports
are slightly lowered (~1%) in Gradle-6.6.1
build compare to Ant-1.7.0
as seen below.
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.fork = true
options.incremental = true
options.encoding = 'UTF-8'
options.debug = true
}
Ant compile
<javac srcdir="${src}"
destdir="${classes}"
excludes="**/package-info.java"
debug="true"
fork="true"
memoryMaximumSize="${javacCoreMaxMem}"
includeAntRuntime="false"
encoding="UTF-8">
<classpath>
<pathelement path="${deps}" />
</classpath>
</javac>
I've made sure that Ant
compile args and Gradle
compileJava Args should match. But not sure why there is discrepancies in reports?
But you are comparing different versions of JaCoCo
Please have a look at changes between these versions - https://www.jacoco.org/jacoco/trunk/doc/changes.html
There are many that change how metrics such as number of instructions or branches are computed.
As one of examples in 0.7.5 there is
As another example in 0.8.0 there is
See also for example https://stackoverflow.com/a/42680333/244993 which shows example where numbers are different between different versions.