Maven版本:回滚错误内容后,成功执行准备/执行 [英] Maven Release: Prepare/Perform after Rollback incorrectly succeeds with wrong content

查看:371
本文介绍了Maven版本:回滚错误内容后,成功执行准备/执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在内部将Maven与Subversion结合使用.我们还使用Maven的Release插件.通过以下(我认为正确)的步骤运行时,我们注意到了下面描述的问题.

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..我们运行release:prepare:

  • Maven将中继版本更新为1.0.0.
  • Maven运行svn copy trunk/myproject tags/myproject-1.0.0,从而创建标签myproject-1.0.0.
  • Maven将中继版本更新为1.0.1-SNAPSHOT.
  • 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..我们运行release:rollback:

  • Maven将中继版本重置为1.0.0-SNAPSHOT.
  • Maven不会删除标签,因为Maven不会做这种事情.

3..我们对主干做出了更多更改,显然是针对版本1.0.0-SNAPSHOT.

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

4..我们再次运行release:prepare:

  • Maven将中继版本更新为1.0.0.
  • Maven运行svn copy trunk/myproject tags/myproject-1.0.0思考,它使用最新的中继线创建了标签myproject-1.0.0.但是,可惜,Subversion(分别为1.6和1.7)将代替Maven创建tags/myproject-1.0.0/myproject.
  • 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..我们运行release:perform:

  • Maven检出标签myproject-1.0.0的内容.
  • Maven构建内容并将结果部署到Nexus.
  • Maven checks out the contents of tag myproject-1.0.0.
  • Maven builds the contents and deploys the result to Nexus.

问题很明显:第3步中的更改未将其添加到代码中.现在,我们发布的1.0.0保持不变.

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.

问题是:我们如何解决这个问题? Maven的发行回滚功能是天生的吗?

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

推荐答案

公平地说,rollback应该将项目和SCM重置为允许第二个prepare发生的状态. 这包括删除标签.答案显而易见(使用谷歌搜索"maven release rollback remove tag"):

In fairness, rollback should reset the project and SCM to a state that allows a second prepare to occur. This includes removing the tag. The answer is now apparent (Googling "maven release rollback remove tag"):

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

在SCM中为该版本创建的分支/标记已删除.注意:这个 尚未实施,因此您需要手动删除 从您的SCM分支/标记.有关更多信息,请参见 MRELEASE-229 .

The created branch/tag in SCM for the release is removed. Note: This is not yet implemented so you will need to manually remove the branch/tag from your SCM. For more info see MRELEASE-229.

然后的解决方案是强制release:rollback包括使用诸如org.codehaus.mojo:exec-maven-plugin之类的命令删除SCM标签的命令.缺少这一点,可以将rollback包装在外部执行此操作的脚本中.

The resolution would then be to force release:rollback to include a command to delete the SCM tag using something like org.codehaus.mojo:exec-maven-plugin. Short of this, wrap rollback inside a script that does that externally.

这篇关于Maven版本:回滚错误内容后,成功执行准备/执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆