How can I change this ant script to gradle?

	<cobertura-instrument datafile="${build.cobertura.dir}/cobertura.ser"  ignoreTrivial="true">
		<fileset dir="${build.cobertura.dir}" />
		<ignoreMethodAnnotation annotationName="com.cesar.microscope.cobertura.CoberturaIgnore"/> 

(Rahul Somasunderam) #2

Please look at the Cobertura Gradle Plugin -

In particular, look at the coverageIgnoreMethodAnnotations on this page -



I understood the coverageIgnoreMethod. But for the first link you shared I am still unclear on how to do it.

(Rahul Somasunderam) #4

This is what I do in one of my gradle builds

buildscript {
  repositories {
  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 = [

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: