Using the FindBugs plugin
FindBugs is another library that we can use to analyze our source code. To use FindBugs in our Gradle builds, we simply have to apply the FindBugs plugin. We can either apply one source code analysis plugin to our project, or we can apply multiple plugins. Each tool has different features. It just depends on what we want to check or what is prescribed per company policy. The plugin will add the tasks findbugsMain
and findbugsTest
to analyze the source code from the main
and test
source sets. If we have a custom source set, then the task findbugs<SourceSet>
is also added to the plugin. These tasks are all dependency tasks for the check
task.
Just as with the other code quality plugins, the FindBugs dependencies are not included with Gradle, but will be downloaded the first time we use the findbugs
tasks. We must include a repository definition that will enable Gradle to find the FindBugs dependencies. To change the FindBugs version that is being used, we can...