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-rar-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new cb5119c  Convert to javax.inject constructor injection (#25)
cb5119c is described below

commit cb5119c3c564df36c03783c0c736d54f8640cd1e
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Sun Dec 1 18:44:51 2024 +0000

    Convert to javax.inject constructor injection (#25)
    
    * Convert to javax.inject constructor injection
---
 pom.xml                                                 |  5 +++++
 src/main/java/org/apache/maven/plugins/rar/RarMojo.java | 17 ++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 49676c7..4a9d04f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,11 @@ under the License.
       <artifactId>javax.inject</artifactId>
       <version>1</version>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.sisu</groupId>
+      <artifactId>org.eclipse.sisu.plexus</artifactId>
+      <scope>provided</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
diff --git a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java 
b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
index b4fe9de..a06736e 100644
--- a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
@@ -37,6 +37,8 @@ package org.apache.maven.plugins.rar;
  * under the License.
  */
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -53,7 +55,6 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -63,7 +64,6 @@ import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.shared.filtering.MavenFilteringException;
 import org.apache.maven.shared.filtering.MavenResourcesExecution;
 import org.apache.maven.shared.filtering.MavenResourcesFiltering;
-import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -304,23 +304,30 @@ public class RarMojo extends AbstractMojo {
     /**
      * The Jar archiver.
      */
-    @Component(role = Archiver.class, hint = "jar")
     private JarArchiver jarArchiver;
 
     /**
      * @since 2.3
      */
-    @Component(role = MavenResourcesFiltering.class, hint = "default")
     protected MavenResourcesFiltering mavenResourcesFiltering;
 
     /**
      * @since 2.4
      */
-    @Component
     private MavenProjectHelper projectHelper;
 
     private File buildDir;
 
+    @Inject
+    public RarMojo(
+            JarArchiver jarArchiver,
+            MavenResourcesFiltering mavenResourcesFiltering,
+            MavenProjectHelper projectHelper) {
+        this.jarArchiver = jarArchiver;
+        this.mavenResourcesFiltering = mavenResourcesFiltering;
+        this.projectHelper = projectHelper;
+    }
+
     /** {@inheritDoc} */
     public void execute() throws MojoExecutionException {
 

Reply via email to