Skip to content

Commit 08e4e49

Browse files
committed
[mvn] Move deprecated component to jsr330 inject
1 parent 62edad6 commit 08e4e49

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ package org.codehaus.mojo.spotbugs
1818
import groovy.xml.XmlParser
1919
import groovy.xml.XmlSlurper
2020

21+
import javax.inject.Inject
22+
2123
import org.apache.commons.io.FileUtils
2224
import org.apache.maven.artifact.repository.ArtifactRepository
2325
import org.apache.maven.doxia.siterenderer.Renderer
2426
import org.apache.maven.doxia.tools.SiteTool
2527
import org.apache.maven.execution.MavenSession
2628
import org.apache.maven.plugin.AbstractMojo
2729
import org.apache.maven.plugin.MojoExecutionException
28-
import org.apache.maven.plugins.annotations.Component
2930
import org.apache.maven.plugins.annotations.Execute
3031
import org.apache.maven.plugins.annotations.LifecyclePhase
3132
import org.apache.maven.plugins.annotations.Mojo
@@ -74,7 +75,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
7475
String spotbugsXmlOutputFilename
7576

7677
/** Doxia Site Renderer. */
77-
@Component(role = Renderer.class)
78+
@Inject
7879
Renderer siteRenderer
7980

8081
/** Directory containing the class files for Spotbugs to analyze. */
@@ -162,7 +163,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
162163
String threshold
163164

164165
/** Artifact resolver, needed to download the coreplugin jar. */
165-
@Component(role = ArtifactResolver.class)
166+
@Inject
166167
ArtifactResolver artifactResolver
167168

168169
/**
@@ -313,15 +314,15 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
313314
*
314315
* @since 2.0
315316
*/
316-
@Component(role = ResourceManager.class)
317+
@Inject
317318
ResourceManager resourceManager
318319

319320
/**
320321
* SiteTool.
321322
*
322323
* @since 2.1
323324
*/
324-
@Component(role = SiteTool.class)
325+
@Inject
325326
SiteTool siteTool
326327

327328
/**

src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ package org.codehaus.mojo.spotbugs
1717

1818
import groovy.ant.AntBuilder
1919

20+
import javax.inject.Inject
21+
2022
import org.apache.maven.artifact.repository.ArtifactRepository
2123
import org.apache.maven.execution.MavenSession
2224
import org.apache.maven.plugin.AbstractMojo
23-
import org.apache.maven.plugins.annotations.Component
2425
import org.apache.maven.plugins.annotations.Mojo
2526
import org.apache.maven.plugins.annotations.Parameter
2627
import org.apache.maven.plugins.annotations.ResolutionScope
@@ -74,11 +75,11 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
7475
PluginArtifact[] plugins
7576

7677
/** Artifact resolver, needed to download the coreplugin jar. */
77-
@Component(role = ArtifactResolver.class)
78+
@Inject
7879
ArtifactResolver artifactResolver
7980

8081
/** Used to look up Artifacts in the remote repository. */
81-
@Component(role = RepositorySystem.class)
82+
@Inject
8283
RepositorySystem factory
8384

8485
/** List of Remote Repositories used by the resolver. */
@@ -139,7 +140,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
139140
*
140141
* @since 2.0
141142
*/
142-
@Component(role = ResourceManager.class)
143+
@Inject
143144
ResourceManager resourceManager
144145

145146
@Override

src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.apache.maven.doxia.siterenderer.Renderer
2727
import org.apache.maven.doxia.tools.SiteTool
2828
import org.apache.maven.execution.MavenSession
2929
import org.apache.maven.plugin.MojoExecutionException
30-
import org.apache.maven.plugins.annotations.Component
3130
import org.apache.maven.plugins.annotations.Mojo
3231
import org.apache.maven.plugins.annotations.Parameter
3332
import org.apache.maven.plugins.annotations.ResolutionScope
@@ -44,6 +43,8 @@ import java.nio.file.Files
4443
import java.nio.file.Paths
4544
import java.util.stream.Collectors
4645

46+
import javax.inject.Inject
47+
4748
/**
4849
* Generates a SpotBugs Report when the site plugin is run.
4950
* The HTML report is generated for site commands only.
@@ -139,7 +140,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
139140
String spotbugsXmlOutputFilename
140141

141142
/** Doxia Site Renderer. */
142-
@Component(role = Renderer.class)
143+
@Inject
143144
Renderer siteRenderer
144145

145146
/** Directory containing the class files for Spotbugs to analyze. */
@@ -235,11 +236,11 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
235236
String threshold
236237

237238
/** Artifact resolver, needed to download the coreplugin jar. */
238-
@Component(role = ArtifactResolver.class)
239+
@Inject
239240
ArtifactResolver artifactResolver
240241

241242
/** Used to look up Artifacts in the remote repository. */
242-
@Component(role = RepositorySystem.class)
243+
@Inject
243244
RepositorySystem factory
244245

245246
/**
@@ -452,15 +453,15 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
452453
*
453454
* @since 2.0
454455
*/
455-
@Component(role = ResourceManager.class)
456+
@Inject
456457
ResourceManager resourceManager
457458

458459
/**
459460
* SiteTool.
460461
*
461462
* @since 2.1
462463
*/
463-
@Component(role = SiteTool.class)
464+
@Inject
464465
SiteTool siteTool
465466

466467
/**

0 commit comments

Comments
 (0)