"No coverage information was collected." when running 'gradle sonarRunner' after generating Jacoco reports
I started with the "java-gradle -simple" example from the Sonar GitHub repo:
I added the jacoco plugin to my build.gradle file in empty to see the unit test coverage results and I see a warning:
No coverage information was collected. Perhaps you forgot to include debugging information in the compiled classes?
I am currently running version 4.3.2 Sonar and this is what I see after running 'gradle test jacocoTestReport sonarRunner':
My build.gradle file looks like this:
apply plugin: 'java'
apply plugin: 'sonar-runner'
apply plugin: 'jacoco'
allprojects {
ext.baseVersion = "0.1"
ext.snapshotVersion = true
group = "org.sonar.tests"
version = "$baseVersion" + (snapshotVersion ? "-SNAPSHOT" : "")
}
sonarRunner {
sonarProperties {
property "sonar.projectName", "Simple Java Gradle Project"
property "sonar.projectKey", "org.codehaus.sonar:example-java-gradle"
property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/test.exec"
property "sonar.binaries", "${project.buildDir}/classes"
property "sonar.sources", "src/main"
property "sonar.tests", "src/test"
property "sonar.java.coveragePlugin", "jacoco"
}
}
buildscript {
repositories { mavenCentral() }
dependencies { classpath 'org.ajoberstar:gradle-jacoco:0.1.0' }
}
test {
ignoreFailures = true
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10'
}
repositories {
mavenCentral()
}
Is there some other configuration I'm missing? Surprisingly, there doesn't seem to be much information about creating unit test coverage with Sonar using Gradle.
+3
source to share