I am using a gradle-cobertura plugin for generating test coverage report which can be found here. The plugin is working absolutely fine. Now I am trying to exclude some of the classes from the coverage report. I have tried to customize the behavior of the Cobertura plugin by using a closure to configure the convention properties as below:
cobertura {
coverageSourceDirs = sourcesSets.main.groovy.srcDirs
coverageExcludes = ['class_name.groovy']
}
But the coverage report still showing the classes that I have excluded. Any help will be appreciated.
Thanks and Regards,
Diganta
You need to use a regular expression.
The example on the plugin’s page shows only a single backslash to escape the dot, but I found I had to use double backslashes (I’m using gradle 1.4).
I will also second the suggestion in the comments to use a newer gradle cobertura plugin – I’ve had good luck with this one.