maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1379888 - in /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira: AbstractJiraDownloader.java JiraMojo.java
Date Sat, 01 Sep 2012 22:47:32 GMT
Author: dennisl
Date: Sat Sep  1 22:47:32 2012
New Revision: 1379888

URL: http://svn.apache.org/viewvc?rev=1379888&view=rev
Log:
[MCHANGES-285] SAXException parsing JIRA XML from JIRA 5.1 

Submitted by: Ton Swieb
Reviewed by: Dennis Lundberg

Add smarts to make the handling of a single version faster when using JQL.

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java?rev=1379888&r1=1379887&r2=1379888&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
Sat Sep  1 22:47:32 2012
@@ -34,6 +34,7 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.params.HttpClientParams;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.issues.Issue;
+import org.apache.maven.plugin.issues.IssueUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Proxy;
@@ -103,6 +104,10 @@ public abstract class AbstractJiraDownlo
     private Settings settings;
     /** Use JQL, JIRA query language, instead of URL parameter based queries */
     private boolean useJql;
+    /** Filter the JIRA query based on the current version */
+    private boolean onlyCurrentVersion;
+    /** The versionPrefix to apply to the POM version */
+    private String versionPrefix;
     /** The pattern used to parse dates from the JIRA xml file. */
     protected String jiraDatePattern;
 
@@ -267,7 +272,27 @@ public abstract class AbstractJiraDownlo
      */
     protected String getFixFor()
     {
-        return null;
+        if ( onlyCurrentVersion && useJql )
+        {
+            // Let JIRA do the filtering of the current version instead of the JIRA mojo.
+            // This way JIRA returns less issues and we do not run into the "nbEntriesMax"
limit that easily.
+
+            String version = ( versionPrefix == null ? "" : versionPrefix ) + project.getVersion();
+
+            // Remove "-SNAPSHOT" from the end of the version, if it's there
+            if ( version != null && version.endsWith( IssueUtils.SNAPSHOT_SUFFIX
) )
+            {
+                return version.substring( 0, version.length() - IssueUtils.SNAPSHOT_SUFFIX.length()
);
+            }
+            else
+            {
+                return version;
+            }
+        }
+        else
+        {
+            return null;
+        }
     }
 
     /**
@@ -769,4 +794,24 @@ public abstract class AbstractJiraDownlo
 	{
 		this.useJql = useJql;
 	}
+
+	public boolean isOnlyCurrentVersion()
+	{
+		return onlyCurrentVersion;
+	}
+
+	public void setOnlyCurrentVersion(boolean onlyCurrentVersion)
+	{
+		this.onlyCurrentVersion = onlyCurrentVersion;
+	}
+
+	public String getVersionPrefix()
+	{
+		return versionPrefix;
+	}
+
+	public void setVersionPrefix(String versionPrefix)
+	{
+		this.versionPrefix = versionPrefix;
+	}
 }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java?rev=1379888&r1=1379887&r2=1379888&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
Sat Sep  1 22:47:32 2012
@@ -435,6 +435,10 @@ public class JiraMojo
         issueDownloader.setSettings( settings );
 
         issueDownloader.setUseJql( useJql );
+        
+        issueDownloader.setOnlyCurrentVersion( onlyCurrentVersion );
+        
+        issueDownloader.setVersionPrefix( versionPrefix );
     }
 
     public void setMockDownloader( AbstractJiraDownloader mockDownloader )



Mime
View raw message