org.gradle.api.plugins.quality

## Class FindBugs

- java.lang.Object
- - org.gradle.api.internal.AbstractTask
  - - org.gradle.api.DefaultTask
    - - org.gradle.api.internal.ConventionTask
      - - org.gradle.api.tasks.SourceTask
        - - org.gradle.api.plugins.quality.FindBugs

- All Implemented Interfaces:
    Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Reporting<FindBugsReports>, Task, PatternFilterable, VerificationTask, org.gradle.util.Configurable<Task>

      @CacheableTask
      public class FindBugs
      extends SourceTask
      implements VerificationTask, Reporting<FindBugsReports>

  Analyzes code with FindBugs. See the FindBugs Manual for additional information on configuration options.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Task

      `Task.Namer`

  - ### Field Summary

    - ### Fields inherited from class org.gradle.api.tasks.SourceTask

      `source`

    - ### Fields inherited from interface org.gradle.api.Task

      `TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FindBugs()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FindBugs` | `extraArgs(Iterable<String> arguments)`
    `FindBugs` | `extraArgs(String... arguments)`
    `FileCollection` | `getClasses()` The classes to be analyzed.
    `FileCollection` | `getClasspath()` Compile class path for the classes to be analyzed.
    `String` | `getEffort()` The analysis effort level.
    `File` | `getExcludeBugsFilter()` The filename of a filter specifying baseline bugs to exclude from being reported.
    `TextResource` | `getExcludeBugsFilterConfig()` A filter specifying baseline bugs to exclude from being reported.
    `File` | `getExcludeFilter()` The filename of a filter specifying bugs to exclude from being reported.
    `TextResource` | `getExcludeFilterConfig()` A filter specifying bugs to exclude from being reported.
    `Collection<String>` | `getExtraArgs()` Any additional arguments (not covered here more explicitly like `effort`) to be passed along to FindBugs.
    `FileCollection` | `getFindbugsClasspath()` Class path holding the FindBugs library.
    `boolean` | `getIgnoreFailures()` Whether or not to allow the build to continue if there are warnings.
    `File` | `getIncludeFilter()` The filename of a filter specifying which bugs are reported.
    `TextResource` | `getIncludeFilterConfig()` A filter specifying which bugs are reported.
    `org.gradle.internal.reflect.Instantiator` | `getInstantiator()`
    `String` | `getMaxHeapSize()` The maximum heap size for the forked findbugs process (ex: '1g').
    `Collection<String>` | `getOmitVisitors()` Similar to `visitors` except that it specifies bug detectors which should not be run.
    `FileCollection` | `getPluginClasspath()` Class path holding any additional FindBugs plugins.
    `String` | `getReportLevel()` The priority threshold for reporting bugs.
    `FindBugsReports` | `getReports()` The reports to be generated by this task.
    `FileTree` | `getSource()` Returns the source for this task, after the include and exclude patterns have been applied.
    `Collection<String>` | `getVisitors()` The bug detectors which should be run.
    `org.gradle.process.internal.worker.WorkerProcessFactory` | `getWorkerProcessBuilderFactory()`
    `FindBugsReports` | `reports(Action<? super FindBugsReports> configureAction)` Configures the reports to be generated by this task.
    `FindBugsReports` | `reports(Closure closure)` Configures the reports to be generated by this task.
    `void` | `run()`
    `void` | `setClasses(FileCollection classes)`
    `void` | `setClasspath(FileCollection classpath)`
    `void` | `setEffort(String effort)`
    `void` | `setExcludeBugsFilter(File filter)` The filename of a filter specifying baseline bugs to exclude from being reported.
    `void` | `setExcludeBugsFilterConfig(TextResource excludeBugsFilterConfig)`
    `void` | `setExcludeFilter(File filter)` The filename of a filter specifying bugs to exclude from being reported.
    `void` | `setExcludeFilterConfig(TextResource excludeFilterConfig)`
    `void` | `setExtraArgs(Collection<String> extraArgs)`
    `void` | `setFindbugsClasspath(FileCollection findbugsClasspath)`
    `void` | `setIgnoreFailures(boolean ignoreFailures)` Specifies whether the build should break when the verifications performed by this task fail.
    `void` | `setIncludeFilter(File filter)` The filename of a filter specifying which bugs are reported.
    `void` | `setIncludeFilterConfig(TextResource includeFilterConfig)`
    `void` | `setMaxHeapSize(String maxHeapSize)`
    `void` | `setOmitVisitors(Collection<String> omitVisitors)`
    `void` | `setPluginClasspath(FileCollection pluginClasspath)`
    `void` | `setReportLevel(String reportLevel)`
    `void` | `setVisitors(Collection<String> visitors)`

    - ### Methods inherited from class org.gradle.api.tasks.SourceTask

      `exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, source`

    - ### Methods inherited from class org.gradle.api.internal.ConventionTask

      `conventionMapping, conventionMapping, getConventionMapping`

    - ### Methods inherited from class org.gradle.api.internal.AbstractTask

      `addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActionClassLoaders, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FindBugs

          public FindBugs()

  - ### Method Detail

    - #### getInstantiator

          @Inject
          public org.gradle.internal.reflect.Instantiator getInstantiator()

    - #### getWorkerProcessBuilderFactory

          @Inject
          public org.gradle.process.internal.worker.WorkerProcessFactory getWorkerProcessBuilderFactory()

    - #### getReports

          public FindBugsReports getReports()

      The reports to be generated by this task.
      Specified by:
        `getReports` in interface `Reporting<FindBugsReports>`
      Returns:
        The reports container

    - #### reports

          public FindBugsReports reports(Closure closure)

      Configures the reports to be generated by this task. The contained reports can be configured by name and closures. Example:

           findbugsTask {
             reports {
               xml {
                 destination "build/findbugs.xml"
               }
             }
           }

      Specified by:
        `reports` in interface `Reporting<FindBugsReports>`
      Parameters:
        `closure` - The configuration
      Returns:
        The reports container

    - #### reports

          public FindBugsReports reports(Action<? super FindBugsReports> configureAction)

      Configures the reports to be generated by this task. The contained reports can be configured by name and closures. Example:

           findbugsTask {
             reports {
               xml {
                 destination "build/findbugs.xml"
               }
             }
           }

      Specified by:
        `reports` in interface `Reporting<FindBugsReports>`
      Parameters:
        `configureAction` - The configuration
      Returns:
        The reports container

    - #### getIncludeFilter

          @Internal
          public File getIncludeFilter()

      The filename of a filter specifying which bugs are reported.

    - #### setIncludeFilter

          public void setIncludeFilter(File filter)

      The filename of a filter specifying which bugs are reported.

    - #### getExcludeFilter

          @Internal
          public File getExcludeFilter()

      The filename of a filter specifying bugs to exclude from being reported.

    - #### setExcludeFilter

          public void setExcludeFilter(File filter)

      The filename of a filter specifying bugs to exclude from being reported.

    - #### getExcludeBugsFilter

          @Internal
          public File getExcludeBugsFilter()

      The filename of a filter specifying baseline bugs to exclude from being reported.

    - #### setExcludeBugsFilter

          public void setExcludeBugsFilter(File filter)

      The filename of a filter specifying baseline bugs to exclude from being reported.

    - #### run

          public void run()
                   throws IOException,
                          InterruptedException

      Throws:
        `IOException`
        `InterruptedException`

    - #### extraArgs

          public FindBugs extraArgs(Iterable<String> arguments)

    - #### extraArgs

          public FindBugs extraArgs(String... arguments)

    - #### getSource

          @PathSensitive(value=RELATIVE)
          public FileTree getSource()

      Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.
      Overrides:
        `getSource` in class `SourceTask`
      Returns:
        The source.

    - #### getClasses

          @SkipWhenEmpty
          @PathSensitive(value=RELATIVE)
          @InputFiles
          public FileCollection getClasses()

      The classes to be analyzed.

    - #### setClasses

          public void setClasses(FileCollection classes)

    - #### getClasspath

          @Classpath
          public FileCollection getClasspath()

      Compile class path for the classes to be analyzed. The classes on this class path are used during analysis but aren't analyzed themselves.

    - #### setClasspath

          public void setClasspath(FileCollection classpath)

    - #### getFindbugsClasspath

          @Classpath
          public FileCollection getFindbugsClasspath()

      Class path holding the FindBugs library.

    - #### setFindbugsClasspath

          public void setFindbugsClasspath(FileCollection findbugsClasspath)

    - #### getPluginClasspath

          @Classpath
          public FileCollection getPluginClasspath()

      Class path holding any additional FindBugs plugins.

    - #### setPluginClasspath

          public void setPluginClasspath(FileCollection pluginClasspath)

    - #### getIgnoreFailures

          @Input
          public boolean getIgnoreFailures()

      Whether or not to allow the build to continue if there are warnings.
      Specified by:
        `getIgnoreFailures` in interface `VerificationTask`
      Returns:
        false, when the build should break on failure, true when the failures should be ignored.

    - #### setIgnoreFailures

          public void setIgnoreFailures(boolean ignoreFailures)

      Description copied from interface: `VerificationTask`
      Specifies whether the build should break when the verifications performed by this task fail.
      Specified by:
        `setIgnoreFailures` in interface `VerificationTask`
      Parameters:
        `ignoreFailures` - false to break the build on failure, true to ignore the failures. The default is false.

    - #### getEffort

          @Input
          @Optional
          public String getEffort()

      The analysis effort level. The value specified should be one of `min`, `default`, or `max`. Higher levels increase precision and find more bugs at the expense of running time and memory consumption.

    - #### setEffort

          public void setEffort(String effort)

    - #### getReportLevel

          @Input
          @Optional
          public String getReportLevel()

      The priority threshold for reporting bugs. If set to `low`, all bugs are reported. If set to `medium` (the default), medium and high priority bugs are reported. If set to `high`, only high priority bugs are reported.

    - #### setReportLevel

          public void setReportLevel(String reportLevel)

    - #### getMaxHeapSize

          @Input
          @Optional
          public String getMaxHeapSize()

      The maximum heap size for the forked findbugs process (ex: '1g').

    - #### setMaxHeapSize

          public void setMaxHeapSize(String maxHeapSize)

    - #### getVisitors

          @Input
          @Optional
          public Collection<String> getVisitors()

      The bug detectors which should be run. The bug detectors are specified by their class names, without any package qualification. By default, all detectors which are not disabled by default are run.

    - #### setVisitors

          public void setVisitors(Collection<String> visitors)

    - #### getOmitVisitors

          @Input
          @Optional
          public Collection<String> getOmitVisitors()

      Similar to `visitors` except that it specifies bug detectors which should not be run. By default, no visitors are omitted.

    - #### setOmitVisitors

          public void setOmitVisitors(Collection<String> omitVisitors)

    - #### getIncludeFilterConfig

          @Incubating
          @Optional
          public TextResource getIncludeFilterConfig()

      A filter specifying which bugs are reported. Replaces the `includeFilter` property.
      Since:
        2.2

    - #### setIncludeFilterConfig

          public void setIncludeFilterConfig(TextResource includeFilterConfig)

    - #### getExcludeFilterConfig

          @Incubating
          @Optional
          public TextResource getExcludeFilterConfig()

      A filter specifying bugs to exclude from being reported. Replaces the `excludeFilter` property.
      Since:
        2.2

    - #### setExcludeFilterConfig

          public void setExcludeFilterConfig(TextResource excludeFilterConfig)

    - #### getExcludeBugsFilterConfig

          @Incubating
          @Optional
          public TextResource getExcludeBugsFilterConfig()

      A filter specifying baseline bugs to exclude from being reported.

    - #### setExcludeBugsFilterConfig

          public void setExcludeBugsFilterConfig(TextResource excludeBugsFilterConfig)

    - #### getExtraArgs

          @Input
          @Optional
          public Collection<String> getExtraArgs()

      Any additional arguments (not covered here more explicitly like `effort`) to be passed along to FindBugs.

      Extra arguments are passed to FindBugs after the arguments Gradle understands (like `effort` but before the list of classes to analyze. This should only be used for arguments that cannot be provided by Gradle directly. Gradle does not try to interpret or validate the arguments before passing them to FindBugs.

      See the FindBugs TextUICommandLine source for available options.

      Since:
        2.6

    - #### setExtraArgs

          public void setExtraArgs(Collection<String> extraArgs)