diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy index 5a8daca7..cbadc0e4 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy @@ -34,7 +34,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver import org.codehaus.plexus.resource.ResourceManager -abstract class BaseViolationCheckMojo extends AbstractMojo { +abstract class BaseViolationCheckMojo extends AbstractMojo implements SpotBugsPluginsTrait { /** Location where generated html will be created. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}', required = true) @@ -223,21 +223,6 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(property = 'spotbugs.omitVisitors') String omitVisitors - /** - * 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. - * - * @since 1.0-beta-1 - */ - @Parameter(property = 'spotbugs.pluginList') - String pluginList - /** * Restrict analysis to the given comma-separated list of classes and packages. * diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy index 87e70fe1..18ad65c6 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy @@ -61,20 +61,6 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait { @Parameter(defaultValue = 'Default', property = 'spotbugs.effort') String effort - /** The plugin list to include in the report. This is a SpotbugsInfo.COMMA-delimited list. */ - @Parameter(property = 'spotbugs.pluginList') - String pluginList - - /** - * Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type, classifier.) - * See Usage for details. - * - * @since 2.4.1 - * @since 4.8.3.0 includes classfier - */ - @Parameter - PluginArtifact[] plugins - /** Artifact resolver, needed to download the coreplugin jar. */ @Inject ArtifactResolver artifactResolver diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy index 730ff8ad..902b3b6f 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy @@ -346,31 +346,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(property = 'spotbugs.omitVisitors') String omitVisitors - /** - * 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. - * - * @since 1.0-beta-1 - */ - @Parameter(property = 'spotbugs.pluginList') - String pluginList - - /** - * Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type, classifier.) - * See Usage for details. - * - * @since 2.4.1 - * @since 4.8.3.0 includes classifier - */ - @Parameter - PluginArtifact[] plugins - /** * Restrict analysis to the given comma-separated list of classes and packages. * diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy index 69b57e05..7b28d145 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy @@ -18,6 +18,7 @@ package org.codehaus.mojo.spotbugs import org.apache.maven.artifact.Artifact import org.apache.maven.plugin.logging.Log +import org.apache.maven.plugins.annotations.Parameter import org.apache.maven.project.ProjectBuildingRequest import org.apache.maven.plugin.MojoExecutionException @@ -40,12 +41,38 @@ trait SpotBugsPluginsTrait { abstract Log getLog() abstract ResourceManager getResourceManager() - // TODO This has been fixed for 2 years now, apply as noted... - // properties in traits should be supported but don't compile currently: - // https://issues.apache.org/jira/browse/GROOVY-7536 - // when fixed, should move pluginList and plugins properties here - abstract String getPluginList() - abstract PluginArtifact[] getPlugins() + /** + *

+ * 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. + *

+ * + * @since 1.0-beta-1 + */ + @Parameter(property = "spotbugs.pluginList") + String pluginList + + /** + *

+ * Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type.) + * See Usage for details. + *

+ * + * + * @since 2.4.1 + */ + @Parameter + PluginArtifact[] plugins; /** * Adds the specified plugins to spotbugs. The coreplugin is always added first.