Xelian
Xelian

Reputation: 17208

Configure findBugs in Gradle 1.10

I am trying to configure findbugs in my project with

findbugs {
    ignoreFailures = true
    reports {
        html { enabled = true }
        xml.enabled = !html.enabled
    }
}

but an error appears

  Could not find method reports() for arguments

 [quality_4gppo4hjtn3ur86ac71a18pai6$_run_closure2_closure4@6651ccf] 
on root project 'Project'.

This code was used in one of my previous projects with Gradle 1.7 and it was working.

Upvotes: 3

Views: 940

Answers (1)

JB Nizet
JB Nizet

Reputation: 691865

You can use the reports method on a FindBugs task. The findbugs plugin creates one for every source set. So if you want to use FindBugs on your main classes, you would use

findbugsMain {
    ignoreFailures = true
    reports {
        html { enabled = true }
        xml.enabled = !html.enabled
    }
}

If you want to configure all the findbugs tasks the same way, then you can simply apply the same configuration to all of them:

tasks.withType(FindBugs) {
    ignoreFailures = true
    reports {
        html { enabled = true }
        xml.enabled = !html.enabled
    }
}

Upvotes: 3

Related Questions