This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 41391f2d [MDEP-966] @Component to @Inject for ListClassesMojo and 
ListRepositoriesMojo (#475)
41391f2d is described below

commit 41391f2db2db61ac758430efd72b909aa7aa0359
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Mon Nov 18 23:41:34 2024 +0000

    [MDEP-966] @Component to @Inject for ListClassesMojo and 
ListRepositoriesMojo (#475)
    
    * @Component to @Inject for ListClassesMojo
    * ListRepositoriesMojo
    * PropertiesMojo
    * AnalyzeReport
    * AnalyzeDuplicateMojo
---
 .../apache/maven/plugins/dependency/ListClassesMojo.java    |  9 +++++++--
 .../maven/plugins/dependency/ListRepositoriesMojo.java      |  9 +++++++--
 .../plugins/dependency/analyze/AnalyzeDuplicateMojo.java    |  9 +++++++--
 .../maven/plugins/dependency/analyze/AnalyzeReport.java     | 13 ++++++++++---
 4 files changed, 31 insertions(+), 9 deletions(-)

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 1cd29ba2..0f20be95 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 java.util.jar.JarFile;
 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 @@ import 
org.eclipse.aether.resolution.DependencyResolutionException;
 @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 d86c3865..5c3eb611 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 java.util.stream.Collectors;
 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 @@ import 
org.eclipse.aether.util.graph.visitor.TreeDependencyVisitor;
 @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 f5f6c6ea..9ad7de2c 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.model.io.xpp3.MavenXpp3Reader;
 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 239bc825..96ffe077 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 class AnalyzeReport extends AbstractMavenReport {
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getName(Locale locale) {
         return getI18nString(locale, "name");
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getDescription(Locale locale) {
         return getI18nString(locale, "description");
     }

Reply via email to