KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I added to a project a set of sources that don't have tests and I don't want them spoil my test coverage statistics. I configured Jacoco in the next way : test { jacoco{ excludes = ['org/bla/**'] includes = ['com/bla/**'] append = false } } jacocoTestReport { dependsOn test description = "Generate Jacoco coverage reports after running tests." reports { xml.enabled true html.enabled true } classDirectories = fileTree(dir: 'build/classes/main', include: 'com/bla/**') sourceDirectories = fileTree(dir: 'scr/main/java', include: 'com/bla/**') } But anyway, when generating the report, Jacoco also includes classes from org.bla Can someone help me ? EDIT After some debugging, it appears that all default outputs are added to org.gradle.testing.jacoco.tasks.JacocoReport#classDirectories in a private method org.gradle.testing.jacoco.plugins.JacocoPlugin#addDefaultReportTasks That's visible when using such code : jacocoTestReport { classDirectories = files('build/classes/main/com/bla') println("-----------------------------------------------------------") getAllClassDirs().each { File file -> println(file.absolutePath) } println("-----------------------------------------------------------") getAdditionalClassDirs().each{ File file -> println(file.absolutePath) } } jacocoTestReport << { println("-----------------------------------------------------------") getAllClassDirs().each { File file -> println(file.absolutePath) } println("-----------------------------------------------------------") getAdditionalClassDirs().each{ File file -> println(file.absolutePath) } } Output ----------------------------------------------------------- <path_here>\build\classe
Tags (comma-separated)
Save Edits
Cancel