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-resolver.git

commit 2b81047a17e665e39261b797a4517b8f7282bbb1
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Fri Dec 13 13:50:29 2024 -0500

    Prefer Guice injection in sample
---
 .../resolver/examples/maven/ResolveArtifactMojo.java     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/maven-resolver-demos/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
 
b/maven-resolver-demos/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
index 3d157be5..a1a215d2 100644
--- 
a/maven-resolver-demos/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
+++ 
b/maven-resolver-demos/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
@@ -23,7 +23,6 @@ import java.util.List;
 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.eclipse.aether.RepositorySystem;
@@ -43,11 +42,6 @@ import org.slf4j.LoggerFactory;
 @Mojo(name = "resolve-artifact", threadSafe = true)
 public class ResolveArtifactMojo extends AbstractMojo {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(ResolveArtifactMojo.class);
-    /**
-     * The entry point to Maven Artifact Resolver, i.e. the component doing 
all the work.
-     */
-    @Component
-    private RepositorySystem repoSystem;
 
     /**
      * The current repository/network configuration of Maven.
@@ -67,6 +61,16 @@ public class ResolveArtifactMojo extends AbstractMojo {
     @Parameter(property = "resolver.artifactCoords", readonly = true)
     private String artifactCoords;
 
+    /**
+     * The entry point to Maven Artifact Resolver; that is, the component 
doing all the work.
+     */
+    private final RepositorySystem repoSystem;
+
+    @Inject
+    public ResolveArtifactMojo(RepositorySystem repoSystem) {
+        this.repoSystem = repoSystem;
+    }
+
     /**
      * The actual execution of the mojo.
      */

Reply via email to