Add a jira-roadmap report.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@367705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
594db1221b
commit
4a2a8c45ab
@ -32,10 +32,19 @@
|
||||
pluginName="maven-jira-plugin"
|
||||
link="jira"
|
||||
description="Report all issues defined in Jira."/>
|
||||
<j:if test="${maven.jira.roadmap}">
|
||||
<doc:registerReport
|
||||
name="Jira Roadmap Report"
|
||||
pluginName=""
|
||||
link="jira-roadmap"
|
||||
description="Report all issues that are scheduled for the next release."
|
||||
/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
<goal name="maven-jira-plugin:deregister">
|
||||
<doc:deregisterReport name="Jira Report"/>
|
||||
<doc:deregisterReport name="Jira Roadmap Report"/>
|
||||
</goal>
|
||||
|
||||
<define:taglib uri="jira">
|
||||
@ -50,7 +59,7 @@
|
||||
name="maven-jira-plugin:report"
|
||||
description="Generate report with all entries defined in Jira">
|
||||
<mkdir dir="${maven.build.dir}/jira"/>
|
||||
|
||||
|
||||
<jira:jira
|
||||
project="${pom}"
|
||||
output="${maven.build.dir}/jira/jira-results.xml"
|
||||
@ -64,11 +73,17 @@
|
||||
jiraUser="${maven.jira.jiraUser}"
|
||||
jiraPassword="${maven.jira.jiraPassword}"
|
||||
component="${maven.jira.component}"
|
||||
roadmap="${maven.jira.roadmap}"
|
||||
/>
|
||||
|
||||
<mkdir dir="${maven.gen.docs}"/>
|
||||
|
||||
<j:catch var="parseresult">
|
||||
|
||||
<j:set var="title" value="Jira Report"/>
|
||||
<j:set var="description" value="Report all issues defined in Jira."/>
|
||||
<j:remove var="roadmapUrl"/>
|
||||
|
||||
<doc:jslFile
|
||||
input="${maven.build.dir}/jira/jira-results.xml"
|
||||
output="${maven.gen.docs}/jira.xml"
|
||||
@ -94,7 +109,44 @@
|
||||
</copy>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
|
||||
<j:if test="${maven.jira.roadmap}">
|
||||
|
||||
<j:catch var="parseresult">
|
||||
|
||||
<j:set var="title" value="Jira Roadmap Report"/>
|
||||
<j:set var="description" value="Report all issues that are scheduled for the next release."/>
|
||||
<j:set var="roadmapUrl" value="${pom.issueTrackingUrl}?report=com.atlassian.jira.plugin.system.project:roadmap-panel"/>
|
||||
|
||||
<doc:jslFile
|
||||
input="${maven.build.dir}/jira/jira-roadmap.xml"
|
||||
output="${maven.gen.docs}/jira-roadmap.xml"
|
||||
stylesheet="${plugin.resources}/jira.jsl"
|
||||
outputMode="xml"
|
||||
prettyPrint="true"
|
||||
/>
|
||||
<j:remove var="roadmapUrl"/>
|
||||
</j:catch>
|
||||
|
||||
<!-- FIXME: Hack, taken from announcement/plugin.jelly -->
|
||||
<ant:replace file="${maven.gen.docs}/jira-roadmap.xml" token="&amp;" value="&"/>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${!empty(parseresult)}">
|
||||
<ant:echo>Error: unable to parse jira results due to an error: ${parseresult.message}. Jira roadmap report will not be generated</ant:echo>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<!-- go on -->
|
||||
<copy todir="${maven.docs.dest}/images/jira" overwrite="no" filtering="no">
|
||||
<fileset dir="${plugin.resources}/images">
|
||||
<include name="**/*.gif"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
@ -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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,10 +32,17 @@
|
||||
<jsl:template match="rss">
|
||||
<document>
|
||||
<properties>
|
||||
<title>Jira Report</title>
|
||||
<title>${title}</title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Jira Report">
|
||||
<section name="${title}">
|
||||
<p>
|
||||
${description}
|
||||
<j:if test="${roadmapUrl != null}">
|
||||
For the latest list, please check the Jira
|
||||
<a href="${roadmapUrl}">roadmap</a>.
|
||||
</j:if>
|
||||
</p>
|
||||
<x:forEach var="entry" select="channel">
|
||||
<table>
|
||||
<thead>
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.3-SNAPSHOT" date="in SVN">
|
||||
<action dev="ltheussl" type="add">Add a jira-roadmap report.</action>
|
||||
<action dev="ltheussl" type="update">Layout changes: mimic default JIRA appearance, also show votes.</action>
|
||||
<action dev="aheritier" type="fix">Icons are corrupted (images are filtered during the copy).</action>
|
||||
</release>
|
||||
|
||||
@ -164,6 +164,19 @@
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.jira.roadmap</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>
|
||||
If set to <code>true</code>, 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.
|
||||
</p>
|
||||
</td>
|
||||
<td><p><code>true</code></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user