Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhance] Add support for classifier #717

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ class PluginArtifact {
String artifactId
String version
String type = "jar"
String classifier
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
String pluginList

/**
* Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type.)
* Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type, classifier.)
* See <a href="./usage.html#Using Detectors from a Repository">Usage</a> for details.
*
* @since 2.4.1
* @since 4.8.3.0 includes classfier
*/
@Parameter
PluginArtifact[] plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,11 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
String pluginList

/**
* Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type.)
* Collection of PluginArtifact to work on. (PluginArtifact contains groupId, artifactId, version, type, classifier.)
* See <a href="./usage.html#Using Detectors from a Repository">Usage</a> for details.
*
* @since 2.4.1
* @since 4.8.3.0 includes classfier
*/
@Parameter
PluginArtifact[] plugins;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ trait SpotBugsPluginsTrait {
plugins.each() { plugin ->

log.debug(" Processing Plugin: " + plugin.toString())
log.debug("groupId is ${plugin['groupId']} ****** artifactId is ${plugin['artifactId']} ****** version is ${plugin['version']} ****** type is ${plugin['type']}")
pomArtifact = this.factory.createArtifact(plugin['groupId'], plugin['artifactId'], plugin['version'], "", plugin['type'])
log.debug("pomArtifact is ${pomArtifact} ****** groupId is ${plugin['groupId']} ****** artifactId is ${plugin['artifactId']} ****** version is ${plugin['version']} ****** type is ${plugin['type']}")
if (plugin['classifier'] == null) {
log.debug("groupId is ${plugin['groupId']} ****** artifactId is ${plugin['artifactId']} ****** version is ${plugin['version']} ****** type is ${plugin['type']}")
pomArtifact = this.factory.createArtifact(plugin['groupId'], plugin['artifactId'], plugin['version'], "", plugin['type'])
log.debug("pomArtifact is ${pomArtifact} ****** groupId is ${pomArtifact['groupId']} ****** artifactId is ${pomArtifact['artifactId']} ****** version is ${pomArtifact['version']} ****** type is ${pomArtifact['type']}")
} else {
log.debug("groupId is ${plugin['groupId']} ****** artifactId is ${plugin['artifactId']} ****** version is ${plugin['version']} ****** type is ${plugin['type']} ****** classifier is ${plugin['classifier']}")
pomArtifact = this.factory.createArtifactWithClassifier(plugin['groupId'], plugin['artifactId'], plugin['version'], "", plugin['type'], plugin['classifier'])
log.debug("pomArtifact is ${pomArtifact} ****** groupId is ${pomArtifact['groupId']} ****** artifactId is ${pomArtifact['artifactId']} ****** version is ${pomArtifact['version']} ****** type is ${pomArtifact['type']} ****** classfier is ${pomArtifact['classifier']}")
}

pomArtifact = artifactResolver.resolveArtifact(configuration, pomArtifact).getArtifact()

Expand Down