MPCHANGES-25: Validate changes.xml

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@291220 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2005-09-23 23:19:37 +00:00
parent 500b43f541
commit f62392ae8f
5 changed files with 130 additions and 2 deletions

View File

@ -24,6 +24,7 @@
xmlns:define="jelly:define" xmlns:define="jelly:define"
xmlns:util="jelly:util" xmlns:util="jelly:util"
xmlns:c="changes:transform" xmlns:c="changes:transform"
xmlns:plugin="plugin"
xmlns:doc="doc"> xmlns:doc="doc">
<goal name="maven-changes-plugin:register"> <goal name="maven-changes-plugin:register">
@ -77,6 +78,24 @@
</goal> </goal>
<goal name="changes:validate"
description="Validates the changes.xml file">
<available
file="${maven.docs.src}/changes.xml"
property="changesFile.available"/>
<j:if test="${changesFile.available}">
<echo>schema=${plugin.resources}/xsd/changes.xsd</echo>
<echo>file=${maven.docs.src}/changes.xml</echo>
<plugin:validate-xml
schema="${plugin.resources}/xsd/changes.xsd"
file="${maven.docs.src}/changes.xml"/>
</j:if>
</goal>
<define:taglib uri="changes:transform"> <define:taglib uri="changes:transform">
<define:tag name="release-version"> <define:tag name="release-version">
<j:useBean var="transformer" class="org.apache.maven.changes.ReleaseVersion"/> <j:useBean var="transformer" class="org.apache.maven.changes.ReleaseVersion"/>

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2005 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.
*/
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="document">
<xs:complexType>
<xs:sequence>
<xs:element ref="properties"/>
<xs:element ref="body"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="author" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="title">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="email" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="body">
<xs:complexType>
<xs:sequence>
<xs:element ref="release" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="release">
<xs:complexType>
<xs:sequence>
<xs:element ref="action" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="version" type="xs:string"/>
<xs:attribute name="date" type="xs:string"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="action">
<xs:complexType>
<xs:attribute name="dev" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="issue" type="xs:string" use="optional"/>
<xs:attribute name="due-to" type="xs:string" use="optional"/>
<xs:attribute name="due-to-email" type="xs:string" use="optional"/>
<xs:sequence>
<xs:element ref="description"/>
<xs:element ref="fixes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="dueto" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="description"/>
<xs:element name="fixes">
<xs:complexType>
<xs:attribute name="issue" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="dueto">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="email" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -25,6 +25,7 @@
</properties> </properties>
<body> <body>
<release version="1.6-SNAPSHOT" date="in SVN"> <release version="1.6-SNAPSHOT" date="in SVN">
<action dev="ltheussl" type="add" issue="MPCHANGES-25">Validate <code>changes.xml</code>.</action>
<action dev="ltheussl" type="add" issue="MPCHANGES-15"> Add multiple due-to/due-to-email support.</action> <action dev="ltheussl" type="add" issue="MPCHANGES-15"> Add multiple due-to/due-to-email support.</action>
<action dev="ltheussl" type="add" issue="MPCHANGES-16"> Add multiple issue support.</action> <action dev="ltheussl" type="add" issue="MPCHANGES-16"> Add multiple issue support.</action>
<action dev="ltheussl" type="fix" issue="MPCHANGES-24">The encoding of changes.xml is not preserved after <code>scm:prepare-release</code>.</action> <action dev="ltheussl" type="fix" issue="MPCHANGES-24">The encoding of changes.xml is not preserved after <code>scm:prepare-release</code>.</action>

View File

@ -43,7 +43,15 @@
project releases. project releases.
</td> </td>
</tr> </tr>
<tr>
<td>changes:validate</td>
<td>
Validates the <code>changes.xml</code> file. Note that this validates
against the new form of the <code>action</code> element as described
<a href="index.html#alternative">here</a>, i.e., the description
of the change has to be contained in a <code>description</code> element.
</td>
</tr>
</table> </table>
</section> </section>
</body> </body>

View File

@ -74,7 +74,7 @@
</document> </document>
]]></source> ]]></source>
<p> <p><a name="alternative"/>
An alternative form of the <code>&lt;action&gt;</code> element An alternative form of the <code>&lt;action&gt;</code> element
allows you to specify several issues and/or several due-to allows you to specify several issues and/or several due-to
elements: elements: