Author: ltheussl
Date: Wed Dec  7 11:14:43 2005
New Revision: 354832

URL: http://svn.apache.org/viewcvs?rev=354832&view=rev
Log:
Fix a bug where changes.xml was not parsed correctly when lenient=true

Modified:
    maven/maven-1/plugins/trunk/announcement/plugin.jelly

Modified: maven/maven-1/plugins/trunk/announcement/plugin.jelly
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/announcement/plugin.jelly?rev=354832&r1=354831&r2=354832&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/announcement/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/announcement/plugin.jelly Wed Dec  7 11:14:43 
2005
@@ -65,11 +65,13 @@
 
   <goal name="announcement:check-version" prereqs="announcement:init">
 
-    <j:choose>
-      <j:when test="${! isLenient}">
-    
-        <x:parse var="doc" xml="${inputFile}"/>
+    <j:set var="changesXmlAvailable" value="false"/>
+    <util:available file="${inputFile}">
+      <j:set var="changesXmlAvailable" value="true"/>
+    </util:available>
 
+      <j:if test="${changesXmlAvailable}">
+        <x:parse var="doc" xml="${inputFile}"/>
         <jsl:stylesheet select="$doc">
           <jsl:template match="document/body/release">
             <x:set var="version" select="string(@version)"/>
@@ -80,11 +82,12 @@
           <jsl:template match="@*"/>
           <jsl:template match="text()"/>
         </jsl:stylesheet>
-      
+      </j:if>
+
+      <j:if test="${!isLenient}">
         <j:if test="${versionFound == null}">
           <ant:fail>The ${versionVariable} release could not be found in the 
changes.xml file.</ant:fail>
         </j:if>
-    
         <!-- Check if a <version> tag is defined in the POM for the current 
release to be announced -->
         <j:if test="${size(pom.versions)!=0}">
           <j:set var="foundTag" value="false"/>
@@ -98,8 +101,9 @@
             <ant:fail>Missing "version" element in the POM for release 
${versionVariable}.</ant:fail>
           </j:if>
         </j:if>
-      </j:when>
-      <j:otherwise>
+      </j:if>
+
+      <j:if test="${!changesXmlAvailable or versionFound == null}">
         <!-- creates an empty changes.xml file -->
         <j:set var="emptyChangesXml" 
value="${maven.build.dir}/empty-changes.xml"/>
         <j:file
@@ -119,9 +123,8 @@
         </j:file>
         <util:file var="emptyChangesXmlFile" name="${emptyChangesXml}"/>
         <x:parse var="doc" xml="${emptyChangesXmlFile}"/>
-      </j:otherwise>
-    </j:choose>
-      
+      </j:if>
+
   </goal>
 
   <goal name="announcement:generate" prereqs="announcement:check-version"
@@ -134,11 +137,6 @@
   <goal name="announcement:generate-all" prereqs="announcement:check-version"
     description="Generate release announcement for all releases">
 
-    <j:set var="changesXmlAvailable" value="false"/>
-    <util:available file="${inputFile}">
-      <j:set var="changesXmlAvailable" value="true"/>
-    </util:available>
-    
     <j:choose>
       <j:when test="${changesXmlAvailable}">
         <x:parse var="doc" xml="${inputFile}"/>


Reply via email to