<cobertura-instrument datafile="${build.cobertura.dir}/cobertura.ser" ignoreTrivial="true">
<fileset dir="${build.cobertura.dir}" />
<ignoreMethodAnnotation annotationName="com.cesar.microscope.cobertura.CoberturaIgnore"/>
</cobertura-instrument>
Please look at the Cobertura Gradle Plugin - https://github.com/stevesaliman/gradle-cobertura-plugin
In particular, look at the coverageIgnoreMethodAnnotations
on this page - https://github.com/stevesaliman/gradle-cobertura-plugin/blob/master/usage.md
HTH
I understood the coverageIgnoreMethod. But for the first link you shared I am still unclear on how to do it.
This is what I do in one of my gradle builds
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.3.1'
}
}
apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin
cobertura {
coverageCheckBranchRate = 100
coverageCheckLineRate = 100
coverageCheckPackageBranchRate = 100
coverageCheckPackageLineRate = 100
coverageCheckTotalBranchRate = 100
coverageCheckTotalLineRate = 100
coverageCheckHaltOnFailure = true
coverageFormats = ['xml', 'html']
coverageExcludes = [
'.*Exception',
'.*Module',
'.*Bootstrap.*',
'.*PromiseAsyncHandlerBridge',
]
}
tasks.findByName('check').dependsOn tasks.findByName('coberturaCheck')
When I run gradle cobertura. I receive an error.
Failure: Build failed with an exception.
*What went wrong:
Execution failed for task ‘:instrument’.
Could not resolve all dependencies for configuration ‘:cobertura’.
Cannot resolve external dependency net.sourceforge.cobertura:cobertura:2.1.1 because no repositories are defined.
Required by:
:microscope-master:1.0