Search code examples
mavenmaven-2maven-3maven-release-pluginmaven-scm

Maven Release: Prepare/Perform after Rollback incorrectly succeeds with wrong content


We use Maven with Subversion internally. We also use Maven's Release plugin. We noticed the issue described below when running through the following (correct, I presume) steps.

1. We run release:prepare:

  • Maven updates the trunk version to 1.0.0.
  • Maven runs svn copy trunk/myproject tags/myproject-1.0.0, thus creating tag myproject-1.0.0.
  • Maven updates the trunk version to 1.0.1-SNAPSHOT.

2. We run release:rollback:

  • Maven resets the trunk version to 1.0.0-SNAPSHOT.
  • Maven does not remove the tag, because Maven doesn't do this kind of stuff.

3. We commit more changes to trunk, obviously against version 1.0.0-SNAPSHOT.


4. We run release:prepare again:

  • Maven updates the trunk version to 1.0.0.
  • Maven runs svn copy trunk/myproject tags/myproject-1.0.0, thinking it created tag myproject-1.0.0 out of the latest trunk. But, alas, Subversion (1.6 and 1.7 alike) will instead create tags/myproject-1.0.0/myproject on Maven's behalf.

5. We run release:perform:

  • Maven checks out the contents of tag myproject-1.0.0.
  • Maven builds the contents and deploys the result to Nexus.

The problem is obvious: the change in step 3 did not make it into the tag. We are now releasing 1.0.0 without the change in it.

The questions are: How can we fix this? Is Maven's release rollback feature inherently broken?


Solution

  • Since Maven Release Plugin version 3.0.0-M1 release:rollback includes scm tag removal. See https://issues.apache.org/jira/browse/MRELEASE-229