Skip to content

Commit

Permalink
[mvn] Move deprecated component to jsr330 inject
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Sep 5, 2024
1 parent 62edad6 commit 08e4e49
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ package org.codehaus.mojo.spotbugs
import groovy.xml.XmlParser
import groovy.xml.XmlSlurper

import javax.inject.Inject

import org.apache.commons.io.FileUtils
import org.apache.maven.artifact.repository.ArtifactRepository
import org.apache.maven.doxia.siterenderer.Renderer
import org.apache.maven.doxia.tools.SiteTool
import org.apache.maven.execution.MavenSession
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugins.annotations.Component
import org.apache.maven.plugins.annotations.Execute
import org.apache.maven.plugins.annotations.LifecyclePhase
import org.apache.maven.plugins.annotations.Mojo
Expand Down Expand Up @@ -74,7 +75,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
String spotbugsXmlOutputFilename

/** Doxia Site Renderer. */
@Component(role = Renderer.class)
@Inject
Renderer siteRenderer

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

/** Artifact resolver, needed to download the coreplugin jar. */
@Component(role = ArtifactResolver.class)
@Inject
ArtifactResolver artifactResolver

/**
Expand Down Expand Up @@ -313,15 +314,15 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
*
* @since 2.0
*/
@Component(role = ResourceManager.class)
@Inject
ResourceManager resourceManager

/**
* SiteTool.
*
* @since 2.1
*/
@Component(role = SiteTool.class)
@Inject
SiteTool siteTool

/**
Expand Down
9 changes: 5 additions & 4 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package org.codehaus.mojo.spotbugs

import groovy.ant.AntBuilder

import javax.inject.Inject

import org.apache.maven.artifact.repository.ArtifactRepository
import org.apache.maven.execution.MavenSession
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugins.annotations.Component
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope
Expand Down Expand Up @@ -74,11 +75,11 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
PluginArtifact[] plugins

/** Artifact resolver, needed to download the coreplugin jar. */
@Component(role = ArtifactResolver.class)
@Inject
ArtifactResolver artifactResolver

/** Used to look up Artifacts in the remote repository. */
@Component(role = RepositorySystem.class)
@Inject
RepositorySystem factory

/** List of Remote Repositories used by the resolver. */
Expand Down Expand Up @@ -139,7 +140,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
*
* @since 2.0
*/
@Component(role = ResourceManager.class)
@Inject
ResourceManager resourceManager

@Override
Expand Down
13 changes: 7 additions & 6 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import org.apache.maven.doxia.siterenderer.Renderer
import org.apache.maven.doxia.tools.SiteTool
import org.apache.maven.execution.MavenSession
import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugins.annotations.Component
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope
Expand All @@ -44,6 +43,8 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.util.stream.Collectors

import javax.inject.Inject

/**
* Generates a SpotBugs Report when the site plugin is run.
* The HTML report is generated for site commands only.
Expand Down Expand Up @@ -139,7 +140,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
String spotbugsXmlOutputFilename

/** Doxia Site Renderer. */
@Component(role = Renderer.class)
@Inject
Renderer siteRenderer

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

/** Artifact resolver, needed to download the coreplugin jar. */
@Component(role = ArtifactResolver.class)
@Inject
ArtifactResolver artifactResolver

/** Used to look up Artifacts in the remote repository. */
@Component(role = RepositorySystem.class)
@Inject
RepositorySystem factory

/**
Expand Down Expand Up @@ -452,15 +453,15 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
*
* @since 2.0
*/
@Component(role = ResourceManager.class)
@Inject
ResourceManager resourceManager

/**
* SiteTool.
*
* @since 2.1
*/
@Component(role = SiteTool.class)
@Inject
SiteTool siteTool

/**
Expand Down

0 comments on commit 08e4e49

Please sign in to comment.