maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1054461 - in /maven/plugins/trunk/maven-changes-plugin/src: it/report-changes-generation/ it/report-changes-interpolation/ it/report-changes-nofile/ it/report-changes-system/ main/java/org/apache/maven/plugin/changes/ site/apt/
Date Sun, 02 Jan 2011 18:59:06 GMT
Author: dennisl
Date: Sun Jan  2 18:59:05 2011
New Revision: 1054461

URL: http://svn.apache.org/viewvc?rev=1054461&view=rev
Log:
[MCHANGES-203] Use the POMs issueManagement.system when selecting the system to use

The way this is implemented may unfortunately mean that some users will need to reconfigure
the plugin if they upgrade. This is because we still have to carry along some backward compatibility
luggage. I have added instructions for this on the usage page. If you look at the changes
made to the ITs in this commit, you'll see what kind of changes I'm talking about.

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-generation/pom.xml
    maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-interpolation/pom.xml
    maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-nofile/pom.xml
    maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-system/pom.xml
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
    maven/plugins/trunk/maven-changes-plugin/src/site/apt/usage.apt.vm

Modified: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-generation/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-generation/pom.xml?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-generation/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-generation/pom.xml Sun
Jan  2 18:59:05 2011
@@ -51,7 +51,9 @@
           <artifactId>maven-changes-plugin</artifactId>
           <version>${changesPluginVersion}</version>
           <configuration>
-            <issueLinkTemplate>http://myjira/browse/%ISSUE%</issueLinkTemplate>
+            <issueLinkTemplatePerSystem>
+              <jira>http://myjira/browse/%ISSUE%</jira>
+            </issueLinkTemplatePerSystem>
           </configuration>                      
         </plugin>
       </plugins>
@@ -89,7 +91,9 @@
         <artifactId>maven-changes-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
-          <issueLinkTemplate>http://myjira/browse/%ISSUE%</issueLinkTemplate>
+          <issueLinkTemplatePerSystem>
+            <jira>http://myjira/browse/%ISSUE%</jira>
+          </issueLinkTemplatePerSystem>
         </configuration>
         <reportSets>
           <reportSet>

Modified: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-interpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-interpolation/pom.xml?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-interpolation/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-interpolation/pom.xml Sun
Jan  2 18:59:05 2011
@@ -87,7 +87,9 @@
         <version>@pom.version@</version>
         <configuration>
           <filteringChanges>true</filteringChanges>
-          <issueLinkTemplate>http://myjira/browse/%ISSUE%</issueLinkTemplate>
+          <issueLinkTemplatePerSystem>
+            <jira>http://myjira/browse/%ISSUE%</jira>
+          </issueLinkTemplatePerSystem>
           <publishDateLocale>en</publishDateLocale>
           <publishDateFormat>yyyy-MM-dd</publishDateFormat>
         </configuration>

Modified: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-nofile/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-nofile/pom.xml?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-nofile/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-nofile/pom.xml Sun Jan
 2 18:59:05 2011
@@ -81,7 +81,9 @@
         <artifactId>maven-changes-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
-          <issueLinkTemplate>http://myjira/browse/%ISSUE%</issueLinkTemplate>
+          <issueLinkTemplatePerSystem>
+            <jira>http://myjira/browse/%ISSUE%</jira>
+          </issueLinkTemplatePerSystem>
         </configuration>
         <reportSets>
           <reportSet>

Modified: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-system/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-system/pom.xml?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-system/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-system/pom.xml Sun Jan
 2 18:59:05 2011
@@ -89,8 +89,8 @@
         <artifactId>maven-changes-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
-          <issueLinkTemplate>http://myjira/browse/%ISSUE%</issueLinkTemplate>
           <issueLinkTemplatePerSystem>
+            <jira>http://myjira/browse/%ISSUE%</jira>
             <qc>http://localhost/%ISSUE%</qc>
           </issueLinkTemplatePerSystem>
           <addActionDate>true</addActionDate>

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
Sun Jan  2 18:59:05 2011
@@ -25,13 +25,13 @@ import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.ResourceBundle;
 
+import org.apache.commons.collections.map.CaseInsensitiveMap;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.shared.filtering.MavenFileFilter;
@@ -78,7 +78,7 @@ public class ChangesMojo
     
     /**
      * Template strings per system that is used to discover the URL to use to display an
issue report. Each key in this
-     * map denotes the (case-sensitive) identifier of the issue tracking system and its value
gives the URL template.
+     * map denotes the (case-insensitive) identifier of the issue tracking system and its
value gives the URL template.
      * <p>
      * There are 2 template tokens you can use. <code>%URL%</code>: this is computed
by getting the
      * <code>&lt;issueManagement&gt;/&lt;url&gt;</code> value
from the POM, and removing the last '/'
@@ -94,6 +94,13 @@ public class ChangesMojo
     private Map issueLinkTemplatePerSystem;
 
     /**
+     * @parameter default-value="${project.issueManagement.system}"
+     * @readonly
+     * @since 2.4
+     */
+    private String system;
+
+    /**
      * @parameter default-value="${project.issueManagement.url}"
      * @readonly
      */
@@ -201,7 +208,8 @@ public class ChangesMojo
     */
     private String publishDateLocale;
     
-    
+    private CaseInsensitiveMap caseInsensitiveIssueLinkTemplatePerSystem;
+
     public boolean canGenerateReport()
     {
         return xmlPath.isFile();
@@ -288,15 +296,37 @@ public class ChangesMojo
         
         report.setEscapeHTML ( escapeHTML );
 
+        // Create a case insensitive version of issueLinkTemplatePerSystem
+        // We need something case insensitive to maintain backward compatibility 
+        if ( issueLinkTemplatePerSystem == null )
+        {
+            caseInsensitiveIssueLinkTemplatePerSystem = new CaseInsensitiveMap();
+        }
+        else
+        {
+            caseInsensitiveIssueLinkTemplatePerSystem = new CaseInsensitiveMap( issueLinkTemplatePerSystem
);
+        }
+
         // Set good default values for issue management systems here, but only
         // if they have not been configured already by the user
         addIssueLinkTemplate( ChangesReportGenerator.DEFAULT_ISSUE_SYSTEM_KEY, issueLinkTemplate
);
+        addIssueLinkTemplate( "Bugzilla", "%URL%/show_bug.cgi?id=%ISSUE%" );
+        addIssueLinkTemplate( "GoogleCode", "%URL%/detail?id=%ISSUE%" );
+        addIssueLinkTemplate( "JIRA", "%URL%/%ISSUE%" );
+        addIssueLinkTemplate( "Mantis", "%URL%/view.php?id=%ISSUE%" );
+        addIssueLinkTemplate( "Redmine", "%URL%/issues/show/%ISSUE%" );
+        addIssueLinkTemplate( "Scarab", "%URL%/issues/id/%ISSUE%" );
+        addIssueLinkTemplate( "SourceForge", "http://sourceforge.net/support/tracker.php?aid=%ISSUE%"
);
+        addIssueLinkTemplate( "Trac", "%URL%/ticket/%ISSUE%" );
+        // @todo Add more issue management systems here
 
         // Show the current issueLinkTemplatePerSystem configuration
-        logIssueLinkTemplatePerSystem( issueLinkTemplatePerSystem );
+        logIssueLinkTemplatePerSystem( caseInsensitiveIssueLinkTemplatePerSystem );
 
-        report.setIssueLinksPerSystem( issueLinkTemplatePerSystem );
+        report.setIssueLinksPerSystem( caseInsensitiveIssueLinkTemplatePerSystem );
         
+        report.setSystem( system );
+
         report.setTeamlist ( teamlist );
 
         report.setUrl( url );
@@ -324,13 +354,13 @@ public class ChangesMojo
      */
     private void addIssueLinkTemplate( String system, String issueLinkTemplate )
     {
-        if ( issueLinkTemplatePerSystem == null )
+        if ( caseInsensitiveIssueLinkTemplatePerSystem == null )
         {
-            issueLinkTemplatePerSystem = new HashMap();
+            caseInsensitiveIssueLinkTemplatePerSystem = new CaseInsensitiveMap();
         }
-        if ( !issueLinkTemplatePerSystem.containsKey( system ) )
+        if ( !caseInsensitiveIssueLinkTemplatePerSystem.containsKey( system ) )
         {
-            issueLinkTemplatePerSystem.put( system, issueLinkTemplate );
+            caseInsensitiveIssueLinkTemplatePerSystem.put( system, issueLinkTemplate );
         }
     }
 

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
Sun Jan  2 18:59:05 2011
@@ -60,6 +60,14 @@ public class ChangesReportGenerator
 
     private ChangesXML report;
 
+    /**
+     * The issue management system to use, for actions that do not specify a
+     * system.
+     *
+     * @since 2.4
+     */
+    private String system;
+
     private String teamlist;
 
     private String url;
@@ -100,6 +108,22 @@ public class ChangesReportGenerator
         this.escapeHTML = escapeHTML;
     }
 
+    /**
+     * @since 2.4
+     */
+    public String getSystem()
+    {
+        return system;
+    }
+
+    /**
+     * @since 2.4
+     */
+    public void setSystem( String system )
+    {
+        this.system = system;
+    }
+
     public void setTeamlist( final String teamlist )
     {
         this.teamlist = teamlist;
@@ -244,8 +268,18 @@ public class ChangesReportGenerator
                 {
                     sink.text( " " + bundle.getString( "report.changes.text.fixes" ) + "
" );
 
+                    // Try to get the issue management system specified in the changes.xml
file
                     String system = action.getSystem();
-                    system = StringUtils.isEmpty( system ) ? DEFAULT_ISSUE_SYSTEM_KEY : system;
+                    // Try to get the issue management system configured in the POM
+                    if ( StringUtils.isEmpty( system ) )
+                    {
+                        system = this.system;
+                    }
+                    // Use the default issue management system
+                    if ( StringUtils.isEmpty( system ) )
+                    {
+                        system = DEFAULT_ISSUE_SYSTEM_KEY;
+                    }
                     if ( !canGenerateIssueLinks( system ) )
                     {
                         constructIssueText( action.getIssue(), sink, action.getFixedIssues()
);

Modified: maven/plugins/trunk/maven-changes-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/site/apt/usage.apt.vm?rev=1054461&r1=1054460&r2=1054461&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/site/apt/usage.apt.vm (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/site/apt/usage.apt.vm Sun Jan  2 18:59:05
2011
@@ -100,7 +100,7 @@ Usage
 </project>
 -------------------
 
-  and execute the site goal to generate the report.
+  and execute the <<<site>>> phase to generate the report.
 
 -------------------
 mvn site
@@ -110,12 +110,59 @@ mvn site
 
   If you use the <<<issue>>> attribute in your <<<changes.xml>>>
file and have
   the <<<\<issueManagement\>>>> element configured in your <<<pom.xml>>>,
the
-  report will contain links to the issues in your issue management system. The
-  default configuration produces links to JIRA, but that can be
-  {{{changes-report-mojo.html}configured}}.
+  report will contain links to the issues in your issue management system.
+
+  Starting with version 2.4 the plugin comes pre-configured for a whole bunch of
+  different issue management systems. All you have to to is enter your issue
+  management system and the URL to it in your POM. It can look like this:
+
+-----
+<project>
+  ...
+  <issueManagement>
+    <system>JIRA</system>
+    <url>http://jira.company.com/</url>
+  </issueManagement>
+  ...
+</project>
+-----
+
+  If you have a previous configuration for <<<\<issueLinkTemplatePerSystem\>>>>
+  in your POM, you can probably throw that away when you start using version 2.4,
+  unless you use more than one issue management system.
+
+  The following table shows the pre-configured issue management systems and the
+  templates they use to create links from your Changes Report directly to the
+  issues in your issue management system.
+
+*-------------+-------------------------------+
+| <<System>>  | <<Issue Link Template>>       |
+*-------------+-------------------------------+
+| Bugzilla    | %URL%/show_bug.cgi?id=%ISSUE% |
+*-------------+-------------------------------+
+| GoogleCode  | %URL%/detail?id=%ISSUE%       |
+*-------------+-------------------------------+
+| JIRA        | %URL%/%ISSUE%                 |
+*-------------+-------------------------------+
+| Mantis      | %URL%/view.php?id=%ISSUE%     |
+*-------------+-------------------------------+
+| Redmine     | %URL%/issues/show/%ISSUE%     |
+*-------------+-------------------------------+
+| Scarab      | %URL%/issues/id/%ISSUE%       |
+*-------------+-------------------------------+
+| SourceForge | http://sourceforge.net/support/tracker.php?aid=%ISSUE% |
+*-------------+-------------------------------+
+| Trac        | %URL%/ticket/%ISSUE%          |
+*-------------+-------------------------------+
+
+  If you use an issue management system other than the ones above, you need to
+  {{{changes-report-mojo.html#issueLinkTemplatePerSystem}configure an issue
+  link template for it}}.
+  We would love to extend the table above with more issue management systems,
+  so if you have a working configuration that is not listed above, please tell
+  us about it by {{{issue-tracking.html}creating an issue for it}}.
 
-  <<Note:>> If you have
-  another issue tracker, make sure that your <<<\<issueManagement\>/\<url\>>>>
is
+  <<Note:>> Make sure that your <<<\<issueManagement\>/\<url\>>>>
is
   correct. In particular, make sure that it has a trailing slash if it needs one.
   The plugin can't add this for you, because it needs to handle different issue
   management systems. If your issue management system is at



Mime
View raw message