```
apply plugin: 'jacoco'
ext {
coverageExclusions = [
'**/*Activity*.*',
'**/*Fragment*.*',
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
]
}
jacoco {
toolVersion = '0.8.6'
reportsDir = file("$buildDir/reports")
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
// https://github.com/gradle/gradle/issues/5184#issuecomment-457865951
jacoco.excludes = ['jdk.internal.*']
}
tasks.withType(Test) {
finalizedBy jacocoTestReport // report is always generated after tests run
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest'])
{
group = "Reporting"
description = "Generate Jacoco coverage reports for Debug build"
reports {
xml.enabled = true
xml.outputLocation.set(new File("${project.buildDir}
/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"))
html.enabled = true
}
def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes",
excludes: coverageExclusions)
def mainSrc = "/src/main/java"
additionalSourceDirs.from = files(mainSrc)
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([debugTree])
executionData.from = files("$buildDir/jacoco/testDebugUnitTest.exec")
}
```
Above is my jacoco.gradle file. I have searched alot for this but not
getting any solution. Jacoco is not able to generate the jacocoTestReport
folder and .xml file because of which sonarqube coverage i am getting is
0%. What wrong i am doing in this ?
--
Confidentiality And Disclaimer Notice
This communication is intended only
for use by the addressee. It may contain legally confidential and/or
privileged information. If you are not the intended recipient or have
received this message in error, please contact us immediately and then
delete this message from your system. You should not copy or use it to
disclose its contents to any other person. Thank you.
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/8cb71667-3608-47fc-a2cc-f256b0d6acdcn%40googlegroups.com.