@org.apache.maven.plugins.annotations.Mojo(name: spotbugs, requiresDependencyResolution: ResolutionScope.TEST, requiresProject: true, threadSafe: true) class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait
Generates a SpotBugs Report when the site plugin is run. The HTML report is generated for site commands only.
| Type | Name and description | 
|---|---|
| boolean | addSourceDirsRun Spotbugs with -sourcepath parameter populated with the known source roots. | 
| int | bugCountThe bug count. | 
| java.util.ResourceBundle | bundleThe resource bundle. | 
| java.lang.String | chooseVisitorsSelectively enable/disable detectors. | 
| java.io.File | classFilesDirectoryDirectory containing the class files for Spotbugs to analyze. | 
| boolean | debugTurn on Spotbugs debugging. | 
| java.lang.String | effortEffort of the bug finders. | 
| int | errorCountThe error count. | 
| java.lang.String | excludeBugsFileFile names of the baseline files. | 
| java.util.List<java.lang.String> | excludeBugsFilesFile names of the baseline files. | 
| java.lang.String | excludeFilterFileFile name of the exclude filter. | 
| java.util.List<java.lang.String> | excludeFilterFilesFile name for exclude filter files. | 
| RepositorySystem | factoryUsed to look up Artifacts in the remote repository. | 
| boolean | failOnErrorFail the build on an error. | 
| boolean | forkFork a VM for Spotbugs analysis. | 
| boolean | htmlOutputTurn on and off HTML output of the Spotbugs report. | 
| java.lang.String | includeFilterFileFile name of the include filter. | 
| java.util.List<java.lang.String> | includeFilterFilesFile name for include filter files. | 
| boolean | includeTestsRun Spotbugs on the tests. | 
| java.lang.String | jvmArgsThe arguments to pass to the forked VM (ignored if fork is disabled). | 
| int | maxHeapMaximum Java heap size in megabytes (default=512). | 
| int | maxRankMaximum bug ranking to record. | 
| boolean | nestedThis option enables or disables scanning of nested jar and zip files found in the list of files and directories to be analyzed. | 
| boolean | noClassOkOutput empty warning file if no classes are specified. | 
| java.lang.String | omitVisitorsThe visitor list to omit. | 
| java.lang.String | onlyAnalyzeRestrict analysis to the given comma-separated list of classes and packages. | 
| java.io.File | outputDirectoryLocation where generated html will be created allowed to be not read only as defined in AbstractMavenParent. | 
| java.lang.String | outputEncodingThe file encoding to use when creating the HTML reports. | 
| java.io.File | outputSpotbugsFileThe output spotbugs file. | 
| java.util.List<Artifact> | pluginArtifactsList of artifacts this plugin depends on. | 
| java.lang.String | pluginListThe plugin list to include in the report. | 
| java.util.List<PluginArtifact> | pluginsCollection of PluginArtifact to work on. | 
| boolean | relaxedRelaxed reporting mode. | 
| RepositorySystem | repositorySystemArtifact resolver, needed to download the plugin jars. | 
| org.codehaus.plexus.resource.ResourceManager | resourceManagerResource Manager. | 
| boolean | sarifFullPathSarif full Path used with sarif. | 
| boolean | sarifOutputTurn on and off SARIF output of the Spotbugs report. | 
| java.io.File | sarifOutputDirectorySpecifies the directory where the sarif output will be generated. | 
| java.lang.String | sarifOutputFilenameSet the name of the output SARIF file produced. | 
| MavenSession | sessionMaven Session. | 
| boolean | skipSkip entire check. | 
| boolean | skipEmptyReportSkip the Spotbugs HTML report generation if there are no violations found. | 
| java.lang.String | sourceEncodingThe file encoding to use when reading the source files. | 
| java.io.File | spotbugsXmlOutputDirectorySpecifies the directory where the Spotbugs native xml output will be generated. | 
| java.lang.String | spotbugsXmlOutputFilenameSet the name of the output XML file produced | 
| java.util.Map<java.lang.String, java.lang.String> | systemPropertyVariablesSystem properties to set in the VM (or the forked VM if fork is enabled). | 
| java.io.File | testClassFilesDirectoryDirectory containing the test class files for Spotbugs to analyze. | 
| java.lang.String | thresholdThreshold of minimum bug severity to report. | 
| int | timeoutSpecifies the amount of time, in milliseconds, that Spotbugs may run before it is assumed to be hung and is terminated. | 
| boolean | tracePrints a trace of detectors run and classes analyzed to standard output. | 
| java.lang.String | userPrefsSet the path of the user preferences file to use. | 
| java.lang.String | visitorsThe visitor list to run. | 
| boolean | xmlOutputTurn on and off xml output of the Spotbugs report. | 
| java.io.File | xmlOutputDirectorySpecifies the directory where the xml output will be generated. | 
| java.io.File | xrefLocationLocation of the Xrefs to link to. | 
| java.io.File | xrefTestLocationLocation of the Test Xrefs to link to. | 
| Constructor and description | 
|---|
| SpotBugsMojo() | 
| Type Params | Return Type | Name and description | 
|---|---|---|
|  | boolean | canGenerateReport()Checks whether prerequisites for generating this report are given. | 
|  | private java.io.File | createSpotbugsAuxClasspathFile()Create the Spotbugs AuxClasspath file. | 
|  | private void | executeCheck() | 
|  | void | executeReport(java.util.Locale locale)Executes the generation of the report. | 
|  | private void | executeSpotbugs(java.io.File outputFile)Set up and run the Spotbugs engine. | 
|  | private static void | forceFileCreation(java.io.File file)For the file creation by creating the file AND folder if needed. | 
|  | private void | generateXDoc(java.util.Locale locale) | 
|  | java.util.ResourceBundle | getBundle(java.util.Locale locale) | 
|  | java.lang.String | getDescription(java.util.Locale locale)Returns the plugins description for the "generated reports" overview page. | 
|  | java.lang.String | getName(java.util.Locale locale)Returns the plugins name for the "generated reports" overview page and the menu. | 
|  | protected java.lang.String | getOutputDirectory()Returns the report output directory allowed to be not read only as defined in AbstractMavenParent. | 
|  | java.lang.String | getOutputName()Returns report output file name, without the extension. | 
|  | java.lang.String | getOutputPath()Returns report output file name, without the extension. | 
|  | private java.util.ArrayList<java.lang.String> | getSpotbugsArgs(java.io.File htmlTempFile, java.io.File xmlTempFile, java.io.File sarifTempFile)Get the Spotbugs command line arguments. | 
|  | protected java.lang.String | getThresholdParameter()Returns the threshold parameter to use. | 
|  | protected boolean | isJxrPluginEnabled()Determines if the JXR-Plugin is included in the report section of the POM. | 
|  | void | setReportOutputDirectory(java.io.File reportOutputDirectory)Set report output directory, allowed to be not read only as defined in AbstractMavenParent. | 
Run Spotbugs with -sourcepath parameter populated with the known source roots.
The bug count.
The resource bundle.
Selectively enable/disable detectors. This is a comma-delimited list with "+" or "-" before each detectors name indicated enabling or disabling.
Directory containing the class files for Spotbugs to analyze.
Turn on Spotbugs debugging.
Effort of the bug finders. Valid values are Min, Default and Max.
The error count.
File names of the baseline files. Bugs found in the baseline files won't be reported.
Potential values are a filesystem path, a URL, or a classpath resource.
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file.
 
This is a comma-delimited list.
File names of the baseline files. Bugs found in the baseline files won't be reported.
Potential values are a filesystem path, a URL, or a classpath resource.
 This is an alternative to <excludeBugsFile> which allows multiple
 files to be specified as separate elements in a pom.
 
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file. 
File name of the exclude filter. Bugs matching the filters are not reported.
Potential values are a filesystem path, a URL, or a classpath resource.
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file.
 It supports multiple files separated by a comma 
File name for exclude filter files. Bugs matching the filters are not reported.
 This is an alternative to <excludeFilterFile> which allows multiple
 files to be specified as separate elements in a pom.
 
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file. 
Used to look up Artifacts in the remote repository.
Fail the build on an error.
Fork a VM for Spotbugs analysis. This will allow you to set timeouts and heap size.
Turn on and off HTML output of the Spotbugs report.
File name of the include filter. Only bugs in matching the filters are reported.
Potential values are a filesystem path, a URL, or a classpath resource.
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file.
 It supports multiple files separated by a comma 
File name for include filter files. Only bugs in matching the filters are reported.
Potential values are a filesystem path, a URL, or a classpath resource.
 This is an alternative to <includeFilterFile> which allows multiple
 files to be specified as separate elements in a pom.
 
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a filter file. 
Run Spotbugs on the tests.
The arguments to pass to the forked VM (ignored if fork is disabled).
Maximum Java heap size in megabytes (default=512). This only works if the fork parameter is set true.
Maximum bug ranking to record.
This option enables or disables scanning of nested jar and zip files found in the list of files and directories to be analyzed.
Output empty warning file if no classes are specified.
The visitor list to omit. This is a comma-delimited list.
Restrict analysis to the given comma-separated list of classes and packages.
Location where generated html will be created allowed to be not read only as defined in AbstractMavenParent.
 The file encoding to use when creating the HTML reports. If the property project.reporting.outputEncoding
 is not set, utf-8 is used. 
The output spotbugs file.
List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin.
The plugin list to include in the report. This is a comma-delimited list.
Potential values are a filesystem path, a URL, or a classpath resource.
 This parameter is resolved as resource, URL, then file. If successfully
 resolved, the contents of the configuration is copied into the
 ${project.build.directory}
 directory before being passed to Spotbugs as a plugin file. 
Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type, classifier.) See Usage for details.
Relaxed reporting mode. For many detectors, this option suppresses the heuristics used to avoid reporting false positives.
Artifact resolver, needed to download the plugin jars.
Resource Manager.
Sarif full Path used with sarif.
Turn on and off SARIF output of the Spotbugs report. SARIF is a JSON format standardize for all code scanning tools. https://docs.github.com/en/code-security/secure-coding/integrating-with-code-scanning/sarif-support-for-code-scanning
Specifies the directory where the sarif output will be generated.
Set the name of the output SARIF file produced.
Maven Session.
Skip entire check.
 Skip the Spotbugs HTML report generation if there are no violations found. Defaults to
 false. 
 The file encoding to use when reading the source files. If the property project.build.sourceEncoding
 is not set, the platform default encoding is used. 
Specifies the directory where the Spotbugs native xml output will be generated.
Set the name of the output XML file produced
System properties to set in the VM (or the forked VM if fork is enabled).
Directory containing the test class files for Spotbugs to analyze.
Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental).
Specifies the amount of time, in milliseconds, that Spotbugs may run before it is assumed to be hung and is terminated. The default is 600,000 milliseconds, which is ten minutes. This only works if the fork parameter is set true.
Prints a trace of detectors run and classes analyzed to standard output. Useful for troubleshooting unexpected analysis failures.
Set the path of the user preferences file to use. Will try to read the path as a resource before treating it as a local path. This will read in a configuration file to set up Spotbugs. The parameters in the POM file will override anything in the config file
The visitor list to run. This is a comma-delimited list.
Turn on and off xml output of the Spotbugs report.
Specifies the directory where the xml output will be generated.
Location of the Xrefs to link to.
Location of the Test Xrefs to link to.
Checks whether prerequisites for generating this report are given.
Create the Spotbugs AuxClasspath file.
Executes the generation of the report. Callback from Maven Site Plugin.
locale -  the wanted locale to generate the report, could be null.Set up and run the Spotbugs engine.
outputFile
 -             the outputFileFor the file creation by creating the file AND folder if needed. The file created will be empty.
file -  Destination file to create.Returns the plugins description for the "generated reports" overview page.
locale
 -             the locale the report should be generated forReturns the plugins name for the "generated reports" overview page and the menu.
locale
 -             the locale the report should be generated forReturns the report output directory allowed to be not read only as defined in AbstractMavenParent. Called by AbstractMavenReport.execute() for creating the sink.
Returns report output file name, without the extension. Called by AbstractMavenReport.execute() for creating the sink.
Returns report output file name, without the extension. Called by AbstractMavenReport.execute() for creating the sink.
Get the Spotbugs command line arguments.
htmlTempFile -  Spotbugs html temp output filexmlTempFile -  Spotbugs xml temp output filesarifTempFile -  Spotbugs sarif temp output fileReturns the threshold parameter to use.
Determines if the JXR-Plugin is included in the report section of the POM.
bundle
 -             The bundle to load the artifactIf of the jxr plugin.Set report output directory, allowed to be not read only as defined in AbstractMavenParent.
spotbugs-maven-plugin Groovy Documentation