diff --git a/jira/plugin.jelly b/jira/plugin.jelly
index 8438a914..806a0948 100644
--- a/jira/plugin.jelly
+++ b/jira/plugin.jelly
@@ -32,10 +32,19 @@
pluginName="maven-jira-plugin"
link="jira"
description="Report all issues defined in Jira."/>
+
+
+
+
@@ -50,7 +59,7 @@
name="maven-jira-plugin:report"
description="Generate report with all entries defined in Jira">
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Error: unable to parse jira results due to an error: ${parseresult.message}. Jira roadmap report will not be generated
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jira/plugin.properties b/jira/plugin.properties
index 49886a0d..c152a672 100644
--- a/jira/plugin.properties
+++ b/jira/plugin.properties
@@ -27,3 +27,4 @@ maven.jira.status=Open,In Progress,Reopened
maven.jira.resolution=Unresolved
maven.jira.priority=
maven.jira.component=
+maven.jira.roadmap=true
\ No newline at end of file
diff --git a/jira/src/main/org/apache/maven/jira/JiraDownloader.java b/jira/src/main/org/apache/maven/jira/JiraDownloader.java
index f8a5820e..aac9345b 100644
--- a/jira/src/main/org/apache/maven/jira/JiraDownloader.java
+++ b/jira/src/main/org/apache/maven/jira/JiraDownloader.java
@@ -90,6 +90,10 @@ public final class JiraDownloader {
/** The maven project. */
private Project project;
+ /** Include a Jira roadmap. */
+ private boolean roadmap;
+
+
/** Mapping containing all JIRA status values. */
private static Map statusMap = new HashMap();
@@ -212,7 +216,7 @@ public final class JiraDownloader {
if (pos >= 0) {
// url
id = url.substring(url.lastIndexOf("=") + 1);
- }
+ }
String jiraUrl = url.substring(0, url.lastIndexOf("/"));
if (jiraUrl.endsWith("secure") || jiraUrl.endsWith("browse")) {
@@ -220,26 +224,37 @@ public final class JiraDownloader {
}
log.info("Jira lives at: " + jiraUrl);
doAuthentication(cl, jiraUrl);
-
- if (id == null) {
- GetMethod gm = new GetMethod(url);
- log.info("Jira URL " + url + " doesn't include a pid, trying to get it");
- try {
+ String projectPage = "";
+
+ if ( id == null || roadmap)
+ {
+ GetMethod gm = new GetMethod( url + "?report=com.atlassian.jira.plugin.system.project:roadmap-panel" );
+ try
+ {
cl.executeMethod(gm);
log.info("Succesfully reached JIRA.");
}
- catch (Exception e) {
- if (log.isDebugEnabled()) {
+ catch (Exception e)
+ {
+ if (log.isDebugEnabled())
+ {
log.error("Unable to reach JIRA project page:", e);
}
- else {
+ else
+ {
log.error("Unable to reach JIRA project page. Cause is: " + e.getLocalizedMessage());
}
}
- String projectPage = gm.getResponseBodyAsString();
+ projectPage = gm.getResponseBodyAsString();
+ }
+
+ if ( id == null )
+ {
+ log.info("Jira URL " + url + " doesn't include a pid, trying to get it");
int pidIndex = projectPage.indexOf("pid="); // @todo, a safer way to get the PID
- if (pidIndex == -1) {
+ if (pidIndex == -1)
+ {
// fail
log.error("Unable to get JIRA pid using url " + project.getIssueTrackingUrl());
return;
@@ -249,7 +264,6 @@ public final class JiraDownloader {
Number pidNumber = nf.parse(projectPage, new ParsePosition(pidIndex + 4));
id = Integer.toString(pidNumber.intValue());
}
-
// create the URL for getting the proper iussues from JIRA
String fullURL = jiraUrl + "/secure/IssueNavigator.jspa?view=rss&pid=" + id;
@@ -257,7 +271,33 @@ public final class JiraDownloader {
fullURL += "&tempMax=" + nbEntriesMax + "&reset=true&decorator=none";
// execute the GET
- download(cl, fullURL);
+ download(cl, fullURL, output);
+
+ if ( roadmap )
+ {
+ int fixforIndex = projectPage.indexOf("fixfor="); // @todo, a safer way to get the PID
+
+ if (fixforIndex == -1)
+ {
+ // fail
+ log.error("Unable to get JIRA roadmap using url " + project.getIssueTrackingUrl());
+ return;
+ }
+
+ NumberFormat nf = NumberFormat.getInstance();
+ Number fixforNumber = nf.parse(projectPage, new ParsePosition(fixforIndex + 7));
+ String fixfor = Integer.toString(fixforNumber.intValue());
+ setFilter("&&fixfor=" + fixfor + "&sorter/field=status&sorter/order=ASC");
+ fullURL = jiraUrl + "/secure/IssueNavigator.jspa?view=rss&pid=" + id;
+ fullURL += createFilter();
+ fullURL += "&tempMax=" + nbEntriesMax + "&reset=true&decorator=none";
+ String outFile = output.getAbsolutePath();
+ int endIndex = outFile.lastIndexOf( '/' );
+ outFile = outFile.substring( 0, endIndex ) + "/jira-roadmap.xml";
+ // execute the GET
+ download(cl, fullURL, new File( outFile ) );
+ }
+
} catch (Exception e) {
log.error("Error accessing " + project.getIssueTrackingUrl(), e);
}
@@ -349,7 +389,7 @@ public final class JiraDownloader {
* the JiraUrl
* @return
*/
- private void download(final HttpClient cl, final String link) {
+ private void download(final HttpClient cl, final String link, final File outFile) {
try {
GetMethod gm = new GetMethod(link);
log.info("Downloading " + link);
@@ -357,7 +397,7 @@ public final class JiraDownloader {
cl.executeMethod(gm);
final String strGetResponseBody = gm.getResponseBodyAsString();
// write the reponse to file
- PrintWriter pw = new PrintWriter(new FileWriter(output));
+ PrintWriter pw = new PrintWriter(new FileWriter(outFile));
pw.print(strGetResponseBody);
pw.close();
StatusLine sl = gm.getStatusLine();
@@ -374,7 +414,7 @@ public final class JiraDownloader {
} else {
String newLink = locationHeader.getValue();
log.debug("Following redirect to " + newLink);
- download(cl, newLink);
+ download(cl, newLink, outFile);
}
}
@@ -516,4 +556,12 @@ public final class JiraDownloader {
this.component = theseComponents;
}
+ /**
+ * Sets the roadmap property.
+ * @param thisRoadmap The roadmap.
+ */
+ public void setRoadmap(final boolean thisRoadmap) {
+ this.roadmap = thisRoadmap;
+ }
+
}
diff --git a/jira/src/plugin-resources/jira.jsl b/jira/src/plugin-resources/jira.jsl
index 8b95dde4..6dfce00c 100644
--- a/jira/src/plugin-resources/jira.jsl
+++ b/jira/src/plugin-resources/jira.jsl
@@ -32,10 +32,17 @@
- Jira Report
+ ${title}
-
+
+
+ ${description}
+
+ For the latest list, please check the Jira
+ roadmap.
+
+
diff --git a/jira/xdocs/changes.xml b/jira/xdocs/changes.xml
index 300ac247..9f17a46e 100644
--- a/jira/xdocs/changes.xml
+++ b/jira/xdocs/changes.xml
@@ -24,6 +24,7 @@
+ Add a jira-roadmap report.Layout changes: mimic default JIRA appearance, also show votes.Icons are corrupted (images are filtered during the copy).
diff --git a/jira/xdocs/properties.xml b/jira/xdocs/properties.xml
index 24450ce7..ae55b3fe 100644
--- a/jira/xdocs/properties.xml
+++ b/jira/xdocs/properties.xml
@@ -164,6 +164,19 @@
+
+
maven.jira.roadmap
+
Yes
+
+
+ If set to true, a report on issues in the Jira
+ roadmap is generated. This includes issues
+ that are fixed in the current development version and issues
+ that are scheduled to be fixed in the next release.
+