Problem:
The problem is that sometimes the scm:prepare-release goal would commit blank project.xml into cvs.
Suggested Cause:
This looks like its due to the fact that the line <r:release-version version="${version_name}" tag="${tag_name}" /> has not finished updating the project.xml, before the project.xml is committed to cvs in the next line. However, our team has not come across any half-completed project.xml just blank or perfectly updated ones.
Suggested Solution:
Add a "sleep" goal inbetween the r:release line and the cvs commit line in the scm:prepare-release goal.
Extra Information:
Here is a maven.xml extract that I hope will you will be able to use to demonstrate the bug and the solution. You should notice in the CVS history of the project.xml you choose to test with that some versions of the checked-in project.xml was blank when running the test goal without the sleep inbetween.
<goal name="release:test-fault"
prereqs="scm:validate">
<echo>Release Test - fault</echo>
<j:forEach begin="0" end="10" indexVar="index">
<j:set var="incrementedVersion" value="${index}-test-SNAPSHOT"/>
<r:release-version version="${incrementedVersion}" tag="Not Tagged"/>
<ant:cvs command="commit -m '[release:test-faulty] testing the release - no: ${index}' -f project.xml"
quiet="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.quiet')}"
cvsRsh="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.rsh')}"
cvsRoot="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.root')}"
failonerror="true"/>
</j:forEach>
</goal>
<goal name="release:test-fix"
prereqs="scm:validate">
<echo>Release Test - fix</echo>
<j:forEach begin="0" end="10" indexVar="index">
<j:set var="incrementedVersion" value="${index}-test-SNAPSHOT"/>
<r:release-version version="${incrementedVersion}" tag="Not Tagged"/>
<echo>Sleeping for 5 secs to allow the Project.xml to be updated</echo>
<ant:sleep seconds="5"/>
<echo>Now doing the commit</echo>
<ant:cvs command="commit -m '[release:test-fix] testing the release - no: ${index}' -f project.xml"
quiet="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.quiet')}"
cvsRsh="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.rsh')}"
cvsRoot="${pom.getPluginContext('maven-scm-plugin').getVariable('maven.scm.cvs.root')}"
failonerror="true"/>
</j:forEach>
</goal>