sbt / sbt-findbugs   2.0.0

Eclipse Public License 1.0 GitHub

FindBugs static analysis plugin for sbt.

Scala versions: 2.10
sbt plugins: 0.13

sbt-findbugs - Static code analysis via FindBugs from within sbt

Build Status Codacy Grade SBT 0.13 version SBT 1.0 version

This sbt plug-in enables you to analyze your (Java) code with the help of the great FindBugs tool. It defines a findbugs sbt action for that purpose.

Install the plugin by adding the following to project/plugins.sbt:

addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "<version>")

And then run the plugin with sbt findbugs. This will generate a FindBugs report in target/scala-xx/findugs/report.xml.

Defining exclude/include filters

Defining filters inline

Just use Scala inline XML for the setting, for example:

findbugsIncludeFilters := Some(<FindBugsFilter>
    <Class name="de.johoop.Meep" />

Using filter files

You can also read the filter settings from files in a more conventional way:

findbugsIncludeFilters := Some(baseDirectory.value / "findbugs-include-filters.xml")

Or, when your configuration is zipped and previously published to a local repo:

findbugsIncludeFilters := {
  val configFiles = = moduleFilter(name = "velvetant-sonar"))
  val configFile = configFiles.headOption flatMap { zippedFile =>
    IO.unzip(zippedFile, target.value / "rules") find ( contains "velvetant-sonar-findbugs.xml")

  configFile map scala.xml.XML.loadFile orElse sys.error("unable to find config file in update report")


(see also the FindBugs documentation)


  • Description: Optionally selects the output format for the FindBugs report.
  • Accepts: Some(FindbugsReportType.{Xml, Html, PlainHtml, FancyHtml, FancyHistHtml, Emacs, Xdoc})
  • Default: Some(FindbugsReportType.Xml)


  • Description: Target path of the report file to generate (optional).
  • Accepts: any legal file path
  • Default: Some(crossTarget.value / "findbugs" / "report.xml")


  • Description: Suppress reporting of bugs based on priority.
  • Accepts: FindbugsPriority.{Relaxed, Low, Medium, High}
  • Default: FindbugsPriority.Medium


  • Description: Decide how much effort to put into analysis.
  • Accepts: FindbugsEffort.{Minimum, Default, Maximum}
  • Default: FindbugsEffort.Default


  • Description: Optionally, define which packages/classes should be analyzed.
  • Accepts: An option containing a List[String] of packages and classes.
  • Default: None (meaning: analyze everything).


  • Description: Maximum amount of memory to allow for FindBugs (in MB).
  • Accepts: any reasonable amount of memory as an integer value
  • Default: 1024


  • Description: Whether FindBugs should analyze nested archives or not.
  • Accepts: true and false
  • Default: true


  • Description: Whether the reported bug instances should be sorted by class name or not.
  • Accepts: true and false
  • Default: false


  • Description: Optional filter file XML content defining which bug instances to include in the static analysis.
  • Accepts: None and Option[Node]
  • Default: None (no include filters).


  • Description: Optional filter file XML content defining which bug instances to exclude in the static analysis.
  • Accepts: None and Some[Node]
  • Default: None (no exclude filters).


  • Description: The path to the classes to be analyzed.
  • Accepts: any sbt.Path
  • Default: Seq(classDirectory in Compile value)


Thanks to @asflierl and @anishathalye for their contributions!


Copyright (c) Joachim Hofer & contributors

All rights reserved.

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at