3

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?

4

2 回答 2

6

公平地说,rollback应该将项目和 SCM 重置为允许一秒钟prepare发生的状态。这包括删除标签。答案现在很明显(谷歌搜索“maven release rollback remove tag”):

http://maven.apache.org/maven-release/maven-release-plugin/examples/rollback-release.html

在 SCM 中为发布创建的分支/标签被删除。注意:这尚未实现,因此您需要手动从 SCM 中删除分支/标签。有关更多信息,请参阅MRELEASE-229

然后,解决方案将强制release:rollback包含使用类似org.codehaus.mojo:exec-maven-plugin. 除此之外,包装rollback在外部执行此操作的脚本中。

于 2013-05-09T15:30:45.260 回答
0

正如您所发现的,release:rollback 在不清理 SCM 时没有很多实用程序。我们的商店所做的是设置我们的 Jenkins 自动化以结合Jenkins M2 Release Plugin运行“mvn release:prepare release:perform” 。

如果失败,我们需要删除 Subversion 中的标签,但是,无论如何,我们必须通过回滚来执行此操作。

于 2013-05-10T08:54:28.330 回答