New RSS feed for releases.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@410401 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b79ad3db5e
commit
7211ccab28
@ -61,7 +61,9 @@
|
|||||||
the latest release of projects.
|
the latest release of projects.
|
||||||
========================================================================
|
========================================================================
|
||||||
-->
|
-->
|
||||||
<goal name="multichanges:report" prereqs="multichanges:init">
|
<goal name="multichanges:report" prereqs="multichanges:generates-releases-report,multichanges:generates-releases-rss"/>
|
||||||
|
|
||||||
|
<goal name="multichanges:generates-releases-file" prereqs="multichanges:init">
|
||||||
|
|
||||||
<!-- Gather project list using the maven reactor -->
|
<!-- Gather project list using the maven reactor -->
|
||||||
<m:reactor
|
<m:reactor
|
||||||
@ -136,6 +138,10 @@
|
|||||||
</releases>
|
</releases>
|
||||||
</j:file>
|
</j:file>
|
||||||
|
|
||||||
|
</goal>
|
||||||
|
|
||||||
|
<goal name="multichanges:generates-releases-report" prereqs="multichanges:generates-releases-file">
|
||||||
|
|
||||||
<ant:dirname property="reportDir" file="${maven.multichanges.report}"/>
|
<ant:dirname property="reportDir" file="${maven.multichanges.report}"/>
|
||||||
<ant:mkdir dir="${reportDir}"/>
|
<ant:mkdir dir="${reportDir}"/>
|
||||||
|
|
||||||
@ -148,6 +154,32 @@
|
|||||||
|
|
||||||
</goal>
|
</goal>
|
||||||
|
|
||||||
|
<goal name="multichanges:generates-releases-rss" prereqs="multichanges:generates-releases-file">
|
||||||
|
|
||||||
|
<tstamp>
|
||||||
|
<format property="currentDate" pattern="EEE, dd MMM yyyy HH:mm:ss Z"/>
|
||||||
|
</tstamp>
|
||||||
|
<tstamp>
|
||||||
|
<format property="currentYear" pattern="yyyy"/>
|
||||||
|
</tstamp>
|
||||||
|
|
||||||
|
<!-- Generate a RSS feed of the changes -->
|
||||||
|
<doc:jsl
|
||||||
|
input="${maven.multichanges.data}"
|
||||||
|
output="releases.rss"
|
||||||
|
stylesheet="${plugin.resources}/releases2rss.jsl"
|
||||||
|
encoding="${maven.docs.outputencoding}"
|
||||||
|
outputMode="xml"
|
||||||
|
prettyPrint="false"/>
|
||||||
|
|
||||||
|
<!-- Copy the images -->
|
||||||
|
<mkdir dir="${maven.docs.dest}/images"/>
|
||||||
|
<copy todir="${maven.docs.dest}/images">
|
||||||
|
<fileset dir="${plugin.resources}/images"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
</goal>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
========================================================================
|
========================================================================
|
||||||
Register the report to the xdoc plugin.
|
Register the report to the xdoc plugin.
|
||||||
|
|||||||
@ -64,5 +64,14 @@
|
|||||||
<timezone>+1</timezone>
|
<timezone>+1</timezone>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
<dependencies/>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.0.4</version>
|
||||||
|
<properties>
|
||||||
|
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
|
||||||
|
</properties>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
package org.apache.maven.plugin.multichanges.util;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a method to convert a date in the changes plugin format
|
||||||
|
* (yyyy-MM-dd) to a date in RSS format (RFC 822).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RssDateFormatter {
|
||||||
|
/**
|
||||||
|
* The date format used in changes report file (changes.xml used in
|
||||||
|
* maven-changes-plugin).
|
||||||
|
*/
|
||||||
|
private final static SimpleDateFormat changesSDF = new SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date format defined in RFC 822 and used in RSS feeds.
|
||||||
|
*/
|
||||||
|
private final static SimpleDateFormat rfc822DF = new SimpleDateFormat(
|
||||||
|
"EEE, dd MMM yyyy HH:mm:ss Z");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log for debug output
|
||||||
|
*/
|
||||||
|
private static Log log = LogFactory.getLog(RssDateFormatter.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a date in the changes plugin format (yyyy-MM-dd) to a date in
|
||||||
|
* RSS format (RFC 822).
|
||||||
|
*
|
||||||
|
* @param changesDate
|
||||||
|
* the date to convert
|
||||||
|
* @return the date in the RFC 822 format. An empty String if an exception
|
||||||
|
* occurs.
|
||||||
|
*/
|
||||||
|
public static final String convertDate(final String changesDate) {
|
||||||
|
try {
|
||||||
|
return rfc822DF.format(changesSDF.parse(changesDate));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
if (log.isDebugEnabled())
|
||||||
|
log
|
||||||
|
.error("Unable to convert the date [" + changesDate
|
||||||
|
+ "]", e);
|
||||||
|
else
|
||||||
|
log.error("Unable to convert the date [" + changesDate + "] : "
|
||||||
|
+ e.getMessage());
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
multichanges/src/plugin-resources/images/rss.png
Normal file
BIN
multichanges/src/plugin-resources/images/rss.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 360 B |
@ -2,7 +2,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Copyright 2004 The Apache Software Foundation.
|
* Copyright 2004-2006 The Apache Software Foundation.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -24,8 +24,12 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<title>Latest releases</title>
|
<title>Latest releases</title>
|
||||||
</properties>
|
</properties>
|
||||||
|
<head>
|
||||||
|
<link rel="alternative" href="releases.rss" type="application/rss+xml" />
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section name="Latest releases">
|
<section name="Latest releases">
|
||||||
|
<p>Get the RSS feed of the last releases <a href="releases.rss"><img src="images/rss.png"/></a></p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Project name</th>
|
<th>Project name</th>
|
||||||
|
|||||||
48
multichanges/src/plugin-resources/releases2rss.jsl
Normal file
48
multichanges/src/plugin-resources/releases2rss.jsl
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* Copyright 2006 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ========================================================================
|
||||||
|
-->
|
||||||
|
<jsl:stylesheet select="$doc" xmlns:jsl="jelly:jsl" xmlns:x="jelly:xml" xmlns:j="jelly:core" xmlns="dummy" trim="false">
|
||||||
|
<!-- This needs to be instantiated here to be available in the template matches -->
|
||||||
|
<j:useBean var="rssDateFormatter" class="org.apache.maven.plugin.multichanges.util.RssDateFormatter"/>
|
||||||
|
<jsl:template match="releases">
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title>${pom.name} releases</title>
|
||||||
|
<link>${pom.url}</link>
|
||||||
|
<description>${pom.name} releases</description>
|
||||||
|
<lastBuildDate>${currentDate}</lastBuildDate>
|
||||||
|
<language>en-us</language>
|
||||||
|
<copyright>Copyright ${currentYear} ${pom.organization.name}</copyright>
|
||||||
|
<x:set var="projects" sort="@date" descending="true" select="project[not(@date = 'Not released') and not(@date = 'No information available')]"/>
|
||||||
|
<j:forEach var="project" items="${projects}">
|
||||||
|
<j:set var="baseUrl"><x:expr select="$project/@url"/></j:set>
|
||||||
|
<j:set var="version"><x:expr select="$project/@version"/></j:set>
|
||||||
|
<j:set var="date"><x:expr select="$project/@date"/></j:set>
|
||||||
|
<item>
|
||||||
|
<title><x:expr select="$project/@name"/> <x:expr select="$project/@version"/> released.</title>
|
||||||
|
<link>${baseUrl}/announcements/announcement-${version}.txt</link>
|
||||||
|
<guid>${baseUrl}/announcements/announcement-${version}.txt</guid>
|
||||||
|
<pubDate>${rssDateFormatter.convertDate(date)}</pubDate>
|
||||||
|
</item>
|
||||||
|
</j:forEach>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
</jsl:template>
|
||||||
|
</jsl:stylesheet>
|
||||||
@ -24,6 +24,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="1.3-SNAPSHOT" date="In SVN">
|
<release version="1.3-SNAPSHOT" date="In SVN">
|
||||||
|
<action dev="aheritier" type="add">New RSS feed for releases.</action>
|
||||||
<action dev="aheritier" type="update">Remove usage of the deprecated dependency-handle tag.</action>
|
<action dev="aheritier" type="update">Remove usage of the deprecated dependency-handle tag.</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="1.2" date="2006-01-07">
|
<release version="1.2" date="2006-01-07">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user