Spotbugs does not report bugs using Gradle

Hi guys, I have a problem, but I don’t know whose fault it is - Gradle or Spotbugs.
I’m using “com.github.spotbugs” plugin for my project, his version is 5.0.7
Gradle version is 7.4

Basically, when I run Spotbugs using Ant, I get 20,000 bugs and that’s the expected number, but when I run Spotbugs using Gradle, the number of bugs reported is zero.

This is my Gradle configuration:


When I see the files generated from Spotbugs, for every .class file, reported bugs are 0 and for the whole project they remain 0.

Can someone explain what I’m doing wrong with the configuration :slight_smile:

It’s my understanding that the plugin automatically creates and configures spotbugs tasks for each sourceSet, so you should not need to configure classDirs and sourceDirs.
If you do need to set those, the default directory for class files of the main sourceSet is $projectDir/build/classes/main. Perhaps not having the correct directory means that spotbugs is unable to correctly match package paths between the source and classes.