Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle - how to exclude Findbugs on /src/test/java

Is there a way to exclude Findbugs execution on classes under /src/test/java. I tried the following but it doesn't seem to work.

classes = classes.filter {
   !it.path.contains("**classes\\test\\org*")
}
like image 556
MFIhsan Avatar asked May 28 '14 20:05

MFIhsan


Video Answer


2 Answers

For Gradle 4.5.1

apply plugin: 'findbugs'

findbugs {
    findbugsTest.enabled = false
}

It isn't mentioned anywhere in documentation, at least I, as 1 day gradle user, don't find it, but it works.

like image 92
user1516873 Avatar answered Sep 20 '22 22:09

user1516873


Sure. The documentation of the Findbugs extension says:

sourceSets : The source sets to be analyzed as part of the check and build tasks.

And the example just above shows an example doing exactly what you want:

apply plugin: "findbugs"

findbugs {
    sourceSets = [sourceSets.main]
}

i.e. only analyze the main sourceSet, and not the test sourceSet.

like image 33
JB Nizet Avatar answered Sep 18 '22 22:09

JB Nizet