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

commit c357ba74cd7add542378a72c00e920e7022961a2
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Mon Dec 16 07:38:59 2024 -0500

    wip
---
 pom.xml                                            | 11 ++++++
 .../org/apache/maven/plugin/doap/DoapMojo.java     | 42 ++++++++++++++--------
 .../org/apache/maven/plugin/doap/DoapMojoTest.java | 10 ------
 3 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/pom.xml b/pom.xml
index e4f5559..0d4c0cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,6 +111,17 @@ under the License.
     </dependency>
 
     <!-- misc -->
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.sisu</groupId>
+      <artifactId>org.eclipse.sisu.plexus</artifactId>
+      <version>0.9.0.M2</version>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
diff --git a/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java 
b/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
index c03f1b0..4846257 100644
--- a/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
+++ b/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugin.doap;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.Writer;
@@ -59,7 +61,6 @@ import org.apache.maven.plugin.doap.options.DoapArtifact;
 import org.apache.maven.plugin.doap.options.DoapOptions;
 import org.apache.maven.plugin.doap.options.ExtOptions;
 import org.apache.maven.plugin.doap.options.Standard;
-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;
@@ -124,32 +125,28 @@ public class DoapMojo extends AbstractMojo {
      *
      * @since 1.0
      */
-    @Component
-    private ScmManager scmManager;
+    private final ScmManager scmManager;
 
     /**
      * Artifact factory.
      *
      * @since 1.0
      */
-    @Component
-    private ArtifactFactory artifactFactory;
+    private final ArtifactFactory artifactFactory;
 
     /**
      * Used to resolve artifacts.
      *
      * @since 1.0
      */
-    @Component
-    private RepositoryMetadataManager repositoryMetadataManager;
+    private final RepositoryMetadataManager repositoryMetadataManager;
 
     /**
      * Internationalization component.
      *
      * @since 1.0
      */
-    @Component
-    private I18N i18n;
+    private final I18N i18n;
 
     // ----------------------------------------------------------------------
     // Mojo parameters
@@ -196,24 +193,21 @@ public class DoapMojo extends AbstractMojo {
      *
      * @since 1.1
      */
-    @Component
-    private ArtifactFactory factory;
+    private final ArtifactFactory factory;
 
     /**
      * Project builder
      *
      * @since 1.1
      */
-    @Component
-    private MavenProjectBuilder mavenProjectBuilder;
+    private final MavenProjectBuilder mavenProjectBuilder;
 
     /**
      * Used for resolving artifacts
      *
      * @since 1.1
      */
-    @Component
-    private ArtifactResolver resolver;
+    private final ArtifactResolver resolver;
 
     /**
      * The current user system settings for use in Maven.
@@ -388,6 +382,24 @@ public class DoapMojo extends AbstractMojo {
      */
     private UserMessages messages = new UserMessages();
 
+    @Inject
+    public DoapMojo(
+            ScmManager scmManager,
+            ArtifactFactory artifactFactory,
+            RepositoryMetadataManager repositoryMetadataManager,
+            I18N i18n,
+            ArtifactFactory factory,
+            MavenProjectBuilder mavenProjectBuilder,
+            ArtifactResolver resolver) {
+        this.scmManager = scmManager;
+        this.artifactFactory = artifactFactory;
+        this.repositoryMetadataManager = repositoryMetadataManager;
+        this.i18n = i18n;
+        this.factory = factory;
+        this.mavenProjectBuilder = mavenProjectBuilder;
+        this.resolver = resolver;
+    }
+
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/maven/plugin/doap/DoapMojoTest.java 
b/src/test/java/org/apache/maven/plugin/doap/DoapMojoTest.java
index 31c673c..da51465 100644
--- a/src/test/java/org/apache/maven/plugin/doap/DoapMojoTest.java
+++ b/src/test/java/org/apache/maven/plugin/doap/DoapMojoTest.java
@@ -35,16 +35,6 @@ import org.codehaus.plexus.util.StringUtils;
  * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
  */
 public class DoapMojoTest extends AbstractMojoTestCase {
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Verify the generation of a pure DOAP file.
      *

Reply via email to