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


The following commit(s) were added to refs/heads/master by this push:
     new 9ca73d0  [MCHANGES-434] @Component --> @Inject (#44)
9ca73d0 is described below

commit 9ca73d0213890b713f1e31c45c436443f311a52f
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Fri Nov 22 15:19:02 2024 +0000

    [MCHANGES-434] @Component --> @Inject (#44)
    
    * @Component --> @Inject
---
 pom.xml                                            | 12 ------
 .../plugins/announcement/AnnouncementMojo.java     | 49 +++++++++-------------
 .../maven/plugins/changes/ChangesReport.java       | 16 +++----
 .../plugins/changes/ChangesValidatorMojo.java      | 17 ++++----
 .../schema/DefaultChangesSchemaValidator.java      |  6 ++-
 .../apache/maven/plugins/github/GitHubReport.java  | 27 +++++++-----
 6 files changed, 59 insertions(+), 68 deletions(-)

diff --git a/pom.xml b/pom.xml
index 77a6f9f..77bef92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -387,18 +387,6 @@ under the License.
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-component-metadata</artifactId>
-        <version>2.2.0</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>generate-metadata</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
       <!-- workaround to remove timestamp inserted by Modello 1.0.1 into 
generated .java and .xsd -->
       <plugin>
         <groupId>org.codehaus.gmaven</groupId>
diff --git 
a/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java 
b/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java
index 4fd7a8f..65b7557 100644
--- a/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java
+++ b/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.announcement;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
@@ -28,7 +30,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.plugin.MojoExecutionException;
-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.plugins.changes.ChangesXML;
@@ -77,7 +78,7 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
     private static final String GIT_HUB = "GitHub";
 
     /**
-     * The name of the file which will contain the generated announcement. If 
no value is specified the plugin will use
+     * The name of the file which will contain the generated announcement. If 
no value is specified, the plugin will use
      * the name of the template.
      *
      * @since 2.4
@@ -229,18 +230,6 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
     @Parameter
     private String urlDownload;
 
-    /**
-     * Velocity Component.
-     */
-    @Component
-    private VelocityComponent velocity;
-
-    /**
-     * Component used to decrypt server information.
-     */
-    @Component
-    private SettingsDecrypter settingsDecrypter;
-
     /**
      * Version of the artifact.
      */
@@ -320,9 +309,6 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
 
     /**
      * The maximum number of issues to fetch from JIRA.
-     * <p>
-     * <b>Note:</b> In versions 2.0-beta-3 and earlier this parameter was 
called "nbEntries".
-     * </p>
      */
     @Parameter(property = "changes.maxEntries", defaultValue = "25", required 
= true)
     private int maxEntries;
@@ -346,9 +332,6 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
     /**
      * Include issues from JIRA with these status ids. Multiple status ids can 
be specified as a comma separated list of
      * ids.
-     * <p>
-     * <b>Note:</b> In versions 2.0-beta-3 and earlier this parameter was 
called "statusId".
-     * </p>
      */
     @Parameter(property = "changes.statusIds", defaultValue = "Closed")
     private String statusIds;
@@ -467,10 +450,26 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
     @Parameter(defaultValue = "false")
     private boolean includeOpenIssues;
 
-    private ReleaseUtils releaseUtils = new ReleaseUtils(getLog());
+    private final ReleaseUtils releaseUtils = new ReleaseUtils(getLog());
 
     private ChangesXML xml;
 
+    /**
+     * Velocity Component.
+     */
+    private VelocityComponent velocity;
+
+    /**
+     * Component used to decrypt server information.
+     */
+    private final SettingsDecrypter settingsDecrypter;
+
+    @Inject
+    public AnnouncementMojo(VelocityComponent velocity, SettingsDecrypter 
settingsDecrypter) {
+        this.velocity = velocity;
+        this.settingsDecrypter = settingsDecrypter;
+    }
+
     // =======================================//
     // announcement-generate execution //
     // =======================================//
@@ -881,14 +880,6 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
         this.urlDownload = urlDownload;
     }
 
-    public VelocityComponent getVelocity() {
-        return velocity;
-    }
-
-    public void setVelocity(VelocityComponent velocity) {
-        this.velocity = velocity;
-    }
-
     public String getVersion() {
         return version;
     }
diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java 
b/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java
index 4b71362..48ab9cd 100644
--- a/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java
+++ b/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.changes;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -35,7 +37,6 @@ import java.util.ResourceBundle;
 
 import org.apache.commons.collections.map.CaseInsensitiveMap;
 import org.apache.commons.io.input.XmlStreamReader;
-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.plugins.changes.model.Release;
@@ -110,12 +111,6 @@ public class ChangesReport extends AbstractChangesReport {
     @Parameter
     private Map<String, String> issueLinkTemplatePerSystem;
 
-    /**
-     * @since 2.2
-     */
-    @Component
-    private MavenFileFilter mavenFileFilter;
-
     /**
      * Format to use for publishDate. The value will be available with the 
following expression ${publishDate}
      *
@@ -179,6 +174,13 @@ public class ChangesReport extends AbstractChangesReport {
 
     private CaseInsensitiveMap caseInsensitiveIssueLinkTemplatePerSystem;
 
+    private MavenFileFilter mavenFileFilter;
+
+    @Inject
+    public ChangesReport(MavenFileFilter mavenFileFilter) {
+        this.mavenFileFilter = mavenFileFilter;
+    }
+
     /* --------------------------------------------------------------------- */
     /* Public methods */
     /* --------------------------------------------------------------------- */
diff --git 
a/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java 
b/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java
index 469c3be..5dd2d76 100644
--- a/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java
+++ b/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java
@@ -18,11 +18,12 @@
  */
 package org.apache.maven.plugins.changes;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.util.List;
 
 import org.apache.maven.plugin.MojoExecutionException;
-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.plugins.changes.schema.ChangesSchemaValidator;
@@ -40,11 +41,6 @@ import org.xml.sax.SAXParseException;
 @Mojo(name = "changes-validate", threadSafe = true)
 public class ChangesValidatorMojo extends AbstractChangesMojo {
 
-    /**
-     */
-    @Component(role = ChangesSchemaValidator.class, hint = "default")
-    private ChangesSchemaValidator changesSchemaValidator;
-
     /**
      * The changes xsd version.
      */
@@ -52,7 +48,7 @@ public class ChangesValidatorMojo extends AbstractChangesMojo 
{
     private String changesXsdVersion;
 
     /**
-     * Mojo failure if validation failed. If not and validation failed only a 
warning will be logged.
+     * Mojo failure if validation failed. If not and validation failed, only a 
warning will be logged.
      */
     @Parameter(property = "changes.validate.failed", defaultValue = "false")
     private boolean failOnError;
@@ -63,6 +59,13 @@ public class ChangesValidatorMojo extends 
AbstractChangesMojo {
     @Parameter(property = "changes.xmlPath", defaultValue = 
"src/changes/changes.xml")
     private File xmlPath;
 
+    private ChangesSchemaValidator changesSchemaValidator;
+
+    @Inject
+    public ChangesValidatorMojo(ChangesSchemaValidator changesSchemaValidator) 
{
+        this.changesSchemaValidator = changesSchemaValidator;
+    }
+
     /**
      * @see org.apache.maven.plugin.Mojo#execute()
      */
diff --git 
a/src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java
 
b/src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java
index 9b4a687..066c99c 100644
--- 
a/src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java
+++ 
b/src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.changes.schema;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
@@ -31,7 +33,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.io.input.XmlStreamReader;
-import org.codehaus.plexus.component.annotations.Component;
 import org.xml.sax.SAXException;
 
 /**
@@ -39,7 +40,8 @@ import org.xml.sax.SAXException;
  * @since 28 juil. 2008
  * @version $Id$
  */
-@Component(role = ChangesSchemaValidator.class, hint = "default")
+@Named
+@Singleton
 public class DefaultChangesSchemaValidator implements ChangesSchemaValidator {
 
     /** property schema */
diff --git a/src/main/java/org/apache/maven/plugins/github/GitHubReport.java 
b/src/main/java/org/apache/maven/plugins/github/GitHubReport.java
index 0e390a3..8c40a34 100644
--- a/src/main/java/org/apache/maven/plugins/github/GitHubReport.java
+++ b/src/main/java/org/apache/maven/plugins/github/GitHubReport.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.github;
 
+import javax.inject.Inject;
+
 import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.List;
@@ -25,7 +27,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
 
-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.plugins.changes.AbstractChangesReport;
@@ -64,12 +65,6 @@ public class GitHubReport extends AbstractChangesReport {
         githubColumns.put("Updated", IssuesReportHelper.COLUMN_UPDATED);
     }
 
-    /**
-     * Component used to decrypt server information.
-     */
-    @Component
-    private SettingsDecrypter settingsDecrypter;
-
     /**
      * Sets the column names that you want to show in the report. The columns 
will appear in the report in the same
      * order as you specify them here. Multiple values can be separated by 
commas.
@@ -125,6 +120,20 @@ public class GitHubReport extends AbstractChangesReport {
     @Parameter(defaultValue = "false")
     private boolean onlyCurrentVersion;
 
+    /**
+     * Component used to decrypt server information.
+     */
+    private SettingsDecrypter settingsDecrypter;
+
+    @Inject
+    public GitHubReport(SettingsDecrypter settingsDecrypter) {
+        this.settingsDecrypter = settingsDecrypter;
+    }
+
+    /* --------------------------------------------------------------------- */
+    /* Public methods */
+    /* --------------------------------------------------------------------- */
+
     @Override
     public String getOutputName() {
         return "github-report";
@@ -140,10 +149,6 @@ public class GitHubReport extends AbstractChangesReport {
         return getBundle(locale).getString("report.issues.description");
     }
 
-    /* --------------------------------------------------------------------- */
-    /* Public methods */
-    /* --------------------------------------------------------------------- */
-
     /**
      * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport()
      */

Reply via email to