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解決策は、のようなものを使用して SCM タグを削除するコマンドを強制的に含めることですorg.codehaus.mojo:exec-maven-plugin。これを除いrollbackて、外部でそれを行うスクリプト内にラップします。

于 2013-05-09T15:30:45.260 に答える
0

お気づきのように、release:rollback は、SCM をクリーンアップしない場合、あまり役に立ちません。当店が行ったことは、Jenkins M2 Release Pluginと組み合わせて "mvn release:prepare release:perform" を実行するように Jenkins 自動化をセットアップすることです。

失敗した場合は、Subversion でタグを削除する必要がありますが、やはりロールバックでこれを行う必要があります。

于 2013-05-10T08:54:28.330 に答える