Skip to content

Commit

Permalink
[maven] Use pluginArtifacts from maven session
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Nov 11, 2024
1 parent 68ea127 commit 11c40e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
@Parameter(defaultValue = 'false', property = 'spotbugs.includeTests')
boolean includeTests

/** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */
@Parameter(property = 'plugin.artifacts', readonly = true, required = true)
List pluginArtifacts

/** Maven Session. */
@Parameter (defaultValue = '${session}', readonly = true, required = true)
MavenSession session
Expand Down
8 changes: 2 additions & 6 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
@Parameter(defaultValue = 'false', property = 'spotbugs.debug')
boolean debug

/** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */
@Parameter(property = 'plugin.artifacts', readonly = true, required = true)
List pluginArtifacts

/** Effort of the bug finders. Valid values are Min, Default and Max. */
@Parameter(defaultValue = 'Default', property = 'spotbugs.effort')
String effort
Expand Down Expand Up @@ -133,7 +129,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
List<String> auxClasspathElements = session.getCurrentProject().compileClasspathElements

if (debug) {
log.debug(' Plugin Artifacts to be added -> ' + pluginArtifacts.toString())
log.debug(' Plugin Artifacts to be added -> ' + session.getCurrentProject().getArtifacts().toString())
}

ant.project.setProperty('basedir', spotbugsXmlOutputDirectory.getAbsolutePath())
Expand Down Expand Up @@ -178,7 +174,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {

classpath() {

pluginArtifacts.each() { pluginArtifact ->
session.getCurrentProject().getArtifacts().each() { pluginArtifact ->
if (debug) {
log.debug(' Trying to Add to pluginArtifact -> ' + pluginArtifact.file.toString())
}
Expand Down
10 changes: 3 additions & 7 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
@Parameter(defaultValue = 'false', property = 'spotbugs.addSourceDirs')
boolean addSourceDirs

/** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */
@Parameter(property = 'plugin.artifacts', readonly = true, required = true)
List pluginArtifacts

/** Maven Session. */
@Parameter (defaultValue = '${session}', readonly = true, required = true)
MavenSession session
Expand Down Expand Up @@ -629,7 +625,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
log.debug('report Output Directory is ' + getReportOutputDirectory())
log.debug('Output Directory is ' + outputDirectory)
log.debug('Classes Directory is ' + classFilesDirectory)
log.debug(' Plugin Artifacts to be added -> ' + pluginArtifacts.toString())
log.debug(' Plugin Artifacts to be added -> ' + session.getCurrentProject().getArtifacts().toString())
}

generateXDoc(locale)
Expand Down Expand Up @@ -1036,7 +1032,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {

if (log.isDebugEnabled()) {
log.debug("resourceManager.outputDirectory is ${resourceManager.outputDirectory}")
log.debug("Plugin Artifacts to be added -> ${pluginArtifacts.toString()}")
log.debug("Plugin Artifacts to be added -> ${session.getCurrentProject().getArtifacts().toString()}")
log.debug("outputFile is ${outputFile.getCanonicalPath()}")
log.debug("output Directory is ${spotbugsXmlOutputDirectory.getAbsolutePath()}")
if (htmlOutput) {
Expand Down Expand Up @@ -1088,7 +1084,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {

classpath() {

pluginArtifacts.each() { pluginArtifact ->
session.getCurrentProject().getArtifacts().each() { pluginArtifact ->
log.debug(' Adding to pluginArtifact -> ' + pluginArtifact.file.toString())

pathelement(location: pluginArtifact.file)
Expand Down

0 comments on commit 11c40e9

Please sign in to comment.