diff --git a/changes/plugin.properties b/changes/plugin.properties index 4d25ca8f..53e4b703 100644 --- a/changes/plugin.properties +++ b/changes/plugin.properties @@ -3,3 +3,12 @@ # ------------------------------------------------------------------- # changes plugin. # ------------------------------------------------------------------- + +# Template that is used to discover the URL to use to display a bug report. +# There are 2 template tokens you can use: +# %URL%: this is computed by getting the value from the +# POM, and removing the context path. +# %ISSUE% : this is the issue number. +# The default template below is the one for the JIRA bug tracker. + +maven.changes.issue.template = %URL%/ViewIssue.jspa?key=%ISSUE% diff --git a/changes/src/main/org/apache/maven/changes/IssueFinder.java b/changes/src/main/org/apache/maven/changes/IssueFinder.java new file mode 100644 index 00000000..c5b535c7 --- /dev/null +++ b/changes/src/main/org/apache/maven/changes/IssueFinder.java @@ -0,0 +1,121 @@ +package org.apache.maven.changes; + +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache Maven" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * "Apache Maven", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * ==================================================================== + */ + +/** + * @author Vincent Massol + * + * @version $Id: IssueFinder.java,v 1.1 2003/11/15 20:13:08 vmassol Exp $ + */ +public class IssueFinder +{ + /** + * @param trackerURL the issue tracker URL (this is supposed to be the + * value of <issueTrackingUrl> found in the POM. + * @param isue the issue reference + * @param template the template string. Allowed template patterns are + * %URL% and %ISSUE%. They will be + * replaced by the base tracker URL extracted from trackerURL and + * by the issue reference. + * @return + */ + public static String getIssueURL(String trackerURL, String issue, + String template) + { + // Find base URL of issue tracker + String baseURL; + int pos = trackerURL.lastIndexOf("/"); + if (pos > 0) { + baseURL = trackerURL.substring(0, pos - 1); + } else { + throw new RuntimeException("Failed to extract tracker URL from [" + + trackerURL + "]"); + } + + // Use template to construct issue URL + String issueURL = replace(template, "%URL%", baseURL); + issueURL = replace(issueURL, "%ISSUE%", issue); + + return issueURL; + } + + /** + * @param original the original template + * @param oldPattern the pattern to replace + * @param newPattern the new pattern + * @return the modified template string with patterns applied + */ + public static final String replace(String original, String oldPattern, + String newPattern) + { + int index, oldIndex; + StringBuffer buffer = new StringBuffer(); + + if((index = original.indexOf(oldPattern)) != -1) { + oldIndex = 0; + while((index = original.indexOf(oldPattern, oldIndex)) != -1) { + buffer.append(original.substring(oldIndex, index)); + buffer.append(newPattern); + oldIndex = index + oldPattern.length(); + } + buffer.append(original.substring(oldIndex)); + original = buffer.toString(); + } + return original; + } + +} \ No newline at end of file diff --git a/changes/src/plugin-resources/changes.jsl b/changes/src/plugin-resources/changes.jsl index 34891afc..391fb370 100644 --- a/changes/src/plugin-resources/changes.jsl +++ b/changes/src/plugin-resources/changes.jsl @@ -51,9 +51,18 @@ + ${type} - + + + + + + + Fixes ${issue} + + ${dev} diff --git a/changes/xdocs/changes.xml b/changes/xdocs/changes.xml index 9affccbc..2ebff088 100644 --- a/changes/xdocs/changes.xml +++ b/changes/xdocs/changes.xml @@ -8,8 +8,11 @@ - - MPCHANGES-3. + + Added new issue attribute to <action> + elements in changes.xml file. + + HTML tags entered inside <action> tags now show up in the generated report. @@ -22,8 +25,7 @@ Update to use maven.docs.*/maven.gen.docs - - Maven-587. + Add index table of release. diff --git a/changes/xdocs/properties.xml b/changes/xdocs/properties.xml index a9045fee..a3cc22b5 100644 --- a/changes/xdocs/properties.xml +++ b/changes/xdocs/properties.xml @@ -2,15 +2,30 @@ - Changes Properties + Changes plugin properties Vincent Massol -
-

- There are no properties for this plugin. -

+
+ + + + + + + + +
PropertyOptional?DescriptionDefault
maven.changes.issue.templateYes + Template string that is used to discover the URL to use to display + a bug report. There are 2 template tokens you can use. + %URL%: this is computed by getting the + <issueTrackingUrl> value from the POM, and + removing the context path. %ISSUE% : this is the issue + number. The default template is the one for the JIRA bug tracker. + + %URL%/ViewIssue.jspa?key=%ISSUE% +