The extension to configure the SpotBugs Gradle plugin. Most of properties in this extension will be used as the default property of all SpotBugsTask. All properties are optional.
Usage:
After you apply the SpotBugs Gradle plugin to project, write extension like below:
spotbugs {
ignoreFailures = false
showProgress = false
reportLevel = 'default'
effort = 'default'
visitors = [ 'FindSqlInjection', 'SwitchFallthrough' ]
omitVisitors = [ 'FindNonShortCircuit' ]
reportsDir = file("$buildDir/reports/spotbugs")
includeFilter = file('spotbugs-include.xml')
excludeFilter = file('spotbugs-exclude.xml')
onlyAnalyze = ['com.foobar.MyClass', 'com.foobar.mypkg.*']
projectName = name
release = version
extraArgs = [ '-nested:false' ]
jvmArgs = [ '-Duser.language=ja' ]
maxHeapSize = '512m'
}See also SpotBugs Manual about configuration.
| Type | Name and description |
|---|---|
static String |
DEFAULT_REPORTS_DIR_NAME |
Property<Effort> |
effortProperty to adjust SpotBugs detectors. |
RegularFileProperty |
excludeFilterProperty to set the filter file to limit which bug should be reported. |
ListProperty<String> |
extraArgsProperty to specify the extra arguments for SpotBugs. |
Property<Boolean> |
ignoreFailures |
RegularFileProperty |
includeFilterProperty to set the filter file to limit which bug should be reported. |
ListProperty<String> |
jvmArgsProperty to specify the extra arguments for JVM process. |
Property<String> |
maxHeapSizeProperty to specify the max heap size ( -Xmx option) of JVM process.
|
ListProperty<String> |
omitVisitorsProperty to disable visitors (detectors) for analysis. |
ListProperty<String> |
onlyAnalyzeProperty to specify the target classes for analysis. |
Property<String> |
projectNameProperty to specify the name of project. |
Property<String> |
releaseProperty to specify the release identifier of project. |
Property<Confidence> |
reportLevelProperty to specify the level to report bugs. |
DirectoryProperty |
reportsDirProperty to set the directory to generate report files. |
Property<Boolean> |
showProgressProperty to enable progress reporting during the analysis. |
Property<String> |
toolVersion |
Property<Boolean> |
useAuxclasspathFile |
ListProperty<String> |
visitorsProperty to enable visitors (detectors) for analysis. |
| Constructor and description |
|---|
SpotBugsExtension
(Project project, ObjectFactory objects) |
Property to adjust SpotBugs detectors. Default value is Effort.DEFAULT.
Property to set the filter file to limit which bug should be reported.
Note that this property will NOT limit which bug should be detected. To limit the target classes to analyze, use onlyAnalyze instead. To limit the visitors (detectors) to run, use visitors and omitVisitors instead.
See also SpotBugs Manual about Filter file.
Property to specify the extra arguments for SpotBugs. Default value is empty so SpotBugs will get no extra argument.
Property to set the filter file to limit which bug should be reported.
Note that this property will NOT limit which bug should be detected. To limit the target classes to analyze, use onlyAnalyze instead. To limit the visitors (detectors) to run, use visitors and omitVisitors instead.
See also SpotBugs Manual about Filter file.
Property to specify the extra arguments for JVM process. Default value is empty so JVM process will get no extra argument.
Property to specify the max heap size (-Xmx option) of JVM process.
Default value is empty so the default configuration made by Gradle will be used.
Property to disable visitors (detectors) for analysis. Default is empty that means SpotBugs omits no visitor.
Property to specify the target classes for analysis. Default value is empty that means all classes are analyzed.
Property to specify the name of project. Some reporting formats use this property. Default value is the name of your Gradle project.
Property to specify the release identifier of project. Some reporting formats use this property. Default value is the version of your Gradle project.
Property to specify the level to report bugs. Default value is Confidence.DEFAULT.
Property to set the directory to generate report files. Default is "$buildDir/reports/spotbugs".
Note that each SpotBugsTask creates own sub-directory in this directory.
Property to enable progress reporting during the analysis. Default value is false.
Property to enable visitors (detectors) for analysis. Default is empty that means all visitors run analysis.
Groovy Documentation