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

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

commit 13cfc2a54b2cb1197b539481daa094c81e3aa89e
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Sun Dec 8 17:39:46 2024 -0500

    Guicify with @Inject
---
 .../plugins/scmpublish/AbstractScmPublishMojo.java | 28 ++++++++++++----------
 .../scmpublish/ScmPublishPublishScmMojo.java       | 11 ++++++++-
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java 
b/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
index f750315..b8eacef 100644
--- 
a/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
+++ 
b/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
@@ -36,7 +36,6 @@ import org.apache.commons.lang3.time.DurationFormatUtils;
 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.Parameter;
 import org.apache.maven.scm.CommandParameter;
 import org.apache.maven.scm.CommandParameters;
@@ -152,18 +151,6 @@ public abstract class AbstractScmPublishMojo extends 
AbstractMojo {
     @Parameter
     private Map<String, String> providerImplementations;
 
-    /**
-     * The SCM manager.
-     */
-    @Component
-    private ScmManager scmManager;
-
-    /**
-     * Tool that gets a configured SCM repository from release configuration.
-     */
-    @Component
-    protected ScmRepositoryConfigurator scmRepositoryConfigurator;
-
     /**
      * The server id specified in the {@code settings.xml}, which should be 
used for the authentication.
      * @see <a href="https://maven.apache.org/settings.html#servers";>Settings 
Reference</a>
@@ -274,6 +261,21 @@ public abstract class AbstractScmPublishMojo extends 
AbstractMojo {
 
     protected ScmRepository scmRepository;
 
+    /**
+     * The SCM manager.
+     */
+    private final ScmManager scmManager;
+
+    /**
+     * Tool that gets a configured SCM repository from release configuration.
+     */
+    protected final ScmRepositoryConfigurator scmRepositoryConfigurator;
+
+    protected AbstractScmPublishMojo(ScmManager scmManager, 
ScmRepositoryConfigurator scmRepositoryConfigurator) {
+        this.scmManager = scmManager;
+        this.scmRepositoryConfigurator = scmRepositoryConfigurator;
+    }
+
     protected void logInfo(String format, Object... params) {
         getLog().info(String.format(format, params));
     }
diff --git 
a/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
 
b/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
index ed16881..2413720 100644
--- 
a/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
+++ 
b/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.scmpublish;
 
+import javax.inject.Inject;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -44,6 +46,8 @@ import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
 import org.apache.maven.shared.utils.logging.MessageUtils;
 import org.codehaus.plexus.util.MatchPatterns;
 
@@ -75,8 +79,13 @@ public class ScmPublishPublishScmMojo extends 
AbstractScmPublishMojo {
     private int files = 0;
     private long size = 0;
 
+    @Inject
+    public ScmPublishPublishScmMojo(ScmManager scmManager, 
ScmRepositoryConfigurator scmRepositoryConfigurator) {
+        super(scmManager, scmRepositoryConfigurator);
+    }
+
     /**
-     * Update scm checkout directory with content.
+     * Update SCM checkout directory with content.
      *
      * @param checkout        the scm checkout directory
      * @param dir             the content to put in scm (can be 
<code>null</code>)

Reply via email to