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

Is there a way to prevent Findbugs from executing for classes under / src / test / java. I tried the following, but it does not work.

classes = classes.filter { !it.path.contains("**classes\\test\\org*") } 
+8
gradle findbugs
source share
2 answers

Of course. Findbugs extension documentation says:

sourceSets: source installations are analyzed as part of the validation and build tasks.

And the example above shows an example that does exactly what you want:

 apply plugin: "findbugs" findbugs { sourceSets = [sourceSets.main] } 

i.e. just analyze the main source, not the test source Set.

+10
source share

For Gradle 4.5.1

 apply plugin: 'findbugs' findbugs { findbugsTest.enabled = false } 

It is not mentioned anywhere in the documentation, at least I, as a 1 day Gradle user, did not find it, but it works.

0
source share

All Articles