diff --git a/src/main/java/org/apache/maven/plugins/dependency/ListClassesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/ListClassesMojo.java index 1cd29ba218..0f20be9592 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/ListClassesMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/ListClassesMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.dependency; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.util.Enumeration; @@ -28,7 +30,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -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.dependency.utils.ParamArtifact; @@ -45,11 +46,15 @@ @Mojo(name = "list-classes", requiresProject = false, threadSafe = true) public class ListClassesMojo extends AbstractMojo { - @Component private ResolverUtil resolverUtil; private ParamArtifact paramArtifact = new ParamArtifact(); + @Inject + public ListClassesMojo(ResolverUtil resolverUtil) { + this.resolverUtil = resolverUtil; + } + /** * The group ID of the artifact to download. Ignored if {@code artifact} is used. * diff --git a/src/main/java/org/apache/maven/plugins/dependency/ListRepositoriesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/ListRepositoriesMojo.java index d86c38653b..5c3eb6116a 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/ListRepositoriesMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/ListRepositoriesMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.dependency; +import javax.inject.Inject; + import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -31,7 +33,6 @@ import org.apache.maven.RepositoryUtils; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.artifact.ArtifactTypeRegistry; @@ -53,9 +54,13 @@ @Mojo(name = "list-repositories", threadSafe = true) public class ListRepositoriesMojo extends AbstractDependencyMojo { - @Component private RepositorySystem repositorySystem; + @Inject + public ListRepositoriesMojo(RepositorySystem repositorySystem) { + this.repositorySystem = repositorySystem; + } + /** * Displays a list of the repositories used by this build. * diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java index f5f6c6ea14..9ad7de2c63 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.dependency.analyze; +import javax.inject.Inject; + import java.io.IOException; import java.io.Reader; import java.util.Collections; @@ -34,7 +36,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -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.project.MavenProject; @@ -66,9 +67,13 @@ public class AnalyzeDuplicateMojo extends AbstractMojo { /** * The Maven project to analyze. */ - @Component private MavenProject project; + @Inject + public AnalyzeDuplicateMojo(MavenProject project) { + this.project = project; + } + /** * {@inheritDoc} */ diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReport.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReport.java index 239bc825ce..96ffe077c0 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReport.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReport.java @@ -18,10 +18,11 @@ */ package org.apache.maven.plugins.dependency.analyze; +import javax.inject.Inject; + import java.util.Locale; import java.util.Set; -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; @@ -48,7 +49,6 @@ public class AnalyzeReport extends AbstractMavenReport { /** * The Maven project dependency analyzer to use. */ - @Component private ProjectDependencyAnalyzer analyzer; /** @@ -87,9 +87,14 @@ public class AnalyzeReport extends AbstractMavenReport { /** * Internationalization component */ - @Component private I18N i18n; + @Inject + public AnalyzeReport(ProjectDependencyAnalyzer analyzer, I18N i18n) { + this.analyzer = analyzer; + this.i18n = i18n; + } + // Mojo methods ----------------------------------------------------------- /* @@ -142,11 +147,13 @@ public String getOutputName() { } /** {@inheritDoc} */ + @Override public String getName(Locale locale) { return getI18nString(locale, "name"); } /** {@inheritDoc} */ + @Override public String getDescription(Locale locale) { return getI18nString(locale, "description"); }