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

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

commit ba87eb6cd181e359b52653a78165fa88b85a75e9
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Mon Nov 18 23:18:08 2024 -0500

    [MDEP-966] Convert more Mojos from PLexus to Guice
---
 .../apache/maven/plugins/dependency/GetMojo.java   | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java 
b/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
index 61fb05fd..e7c58e42 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
@@ -24,6 +24,8 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.inject.Inject;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
@@ -35,7 +37,6 @@ import org.apache.maven.execution.MavenSession;
 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.DefaultProjectBuildingRequest;
@@ -59,28 +60,22 @@ import 
org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverE
 public class GetMojo extends AbstractMojo {
     private static final Pattern ALT_REPO_SYNTAX_PATTERN = 
Pattern.compile("(.+)::(.*)::(.+)");
 
-    @Component
     private MavenSession session;
 
-    @Component
     private ArtifactResolver artifactResolver;
 
-    @Component
     private DependencyResolver dependencyResolver;
 
-    @Component
     private ArtifactHandlerManager artifactHandlerManager;
 
     /**
      * Map that contains the layouts.
      */
-    @Component(role = ArtifactRepositoryLayout.class)
     private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
 
     /**
      * The repository system.
      */
-    @Component
     private RepositorySystem repositorySystem;
 
     private DefaultDependableCoordinate coordinate = new 
DefaultDependableCoordinate();
@@ -98,9 +93,6 @@ public class GetMojo extends AbstractMojo {
     @Parameter(property = "artifact")
     private String artifact;
 
-    /**
-     *
-     */
     @Parameter(defaultValue = "${project.remoteArtifactRepositories}", 
readonly = true, required = true)
     private List<ArtifactRepository> pomRemoteRepositories;
 
@@ -118,6 +110,20 @@ public class GetMojo extends AbstractMojo {
     @Parameter(property = "mdep.skip", defaultValue = "false")
     private boolean skip;
 
+    @Inject
+    public GetMojo(MavenSession session, ArtifactResolver artifactResolver,
+            DependencyResolver dependencyResolver,
+            ArtifactHandlerManager artifactHandlerManager,
+            Map<String, ArtifactRepositoryLayout> repositoryLayouts,
+            RepositorySystem repositorySystem) {
+        this.session = session;
+        this.artifactResolver = artifactResolver;
+        this.dependencyResolver = dependencyResolver;
+        this.artifactHandlerManager = artifactHandlerManager;
+        this.repositoryLayouts = repositoryLayouts;
+        this.repositorySystem = repositorySystem;
+    }
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (isSkip()) {

Reply via email to