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

sjaranowski 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 ba129c8  [MCHANGES-369] Add onlyCurrentVersion for 
announcement-generate
ba129c8 is described below

commit ba129c8cb0b0c49cfa0b1c0babbdb6553167c7bb
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Tue Dec 3 20:50:19 2024 +0100

    [MCHANGES-369] Add onlyCurrentVersion for announcement-generate
---
 .../plugins/changes/announcement/AnnouncementMojo.java  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git 
a/src/main/java/org/apache/maven/plugins/changes/announcement/AnnouncementMojo.java
 
b/src/main/java/org/apache/maven/plugins/changes/announcement/AnnouncementMojo.java
index fbef81e..aa2e990 100644
--- 
a/src/main/java/org/apache/maven/plugins/changes/announcement/AnnouncementMojo.java
+++ 
b/src/main/java/org/apache/maven/plugins/changes/announcement/AnnouncementMojo.java
@@ -275,6 +275,15 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
     @Parameter(property = "changes.maxEntries", defaultValue = "25", required 
= true)
     private int maxEntries;
 
+    /**
+     * If you only want to show issues from JIRA for the current version in 
the report. The current version being used is
+     * <code>${project.version}</code> minus any "-SNAPSHOT" suffix.
+     *
+     * @since 3.0.0
+     */
+    @Parameter(defaultValue = "false")
+    private boolean onlyCurrentVersion;
+
     /**
      * Include issues from JIRA with these resolution ids. Multiple resolution 
ids can be specified as a comma separated
      * list of ids.
@@ -637,6 +646,8 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
         jiraDownloader.setSettingsDecrypter(settingsDecrypter);
 
         jiraDownloader.setNbEntries(maxEntries);
+        jiraDownloader.setOnlyCurrentVersion(onlyCurrentVersion);
+        jiraDownloader.setVersionPrefix(versionPrefix);
 
         jiraDownloader.setFilter(filter);
 
@@ -665,6 +676,12 @@ public class AnnouncementMojo extends 
AbstractAnnouncementMojo {
                         + " that matched the versionPrefix '" + versionPrefix 
+ "'.");
             }
 
+            if (onlyCurrentVersion) {
+                String version = (versionPrefix == null ? "" : versionPrefix) 
+ project.getVersion();
+                issueList = IssueUtils.getIssuesForVersion(issueList, version);
+                getLog().debug("The JIRA Report will contain issues only for 
the current version.");
+            }
+
             return getReleases(issueList, new JIRAIssueManagmentSystem());
         } catch (Exception e) {
             throw new MojoExecutionException("Failed to extract issues from 
JIRA.", e);

Reply via email to