6

I have a maven project which is stored in our GIT repository. When I make a release of this project with mvn release:prepare and mvn release:perform sometimes it fails in the later step but a tag is created for this release anyway. This tag doesn't get removed with mvn release:rollback, and if I try to prepare the release again it fails with this tag-already-exists error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project lwl-module: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-tag command failed.
[ERROR] Command output:
[ERROR] fatal: tag 'lwl-module-1.5.1' already exists
[ERROR] -> [Help 1]
[ERROR]

Is there a way to get mvn release:rollback to delete the last tag in our GIT repository?

I'm using this release plugin:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.2</version>
        </plugin>
Pearl Jade
  • 716
  • 1
  • 8
  • 22

3 Answers3

3

This is currently not supported by the Maven Release Plugin.

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

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.

The ticket (https://issues.apache.org/jira/browse/MRELEASE-229) has been open since 2007.

nwinkler
  • 52,665
  • 21
  • 154
  • 168
2

Depending on the problem that caused mvn release:perfom to fail, you can also just not rollback the release and after having fixed the problem run mvn release:perform directly, without running mvn release:prepare.

Henrique Ordine
  • 3,337
  • 4
  • 44
  • 70
  • 1
    That's a good point - I have done that before in similar cases. It might not work all the time, but in some cases it was the right solution! – nwinkler Jul 07 '15 at 12:13
0

The plugin version 3.0.0-M1 fixes this. The previous versions won't remove the tag.

I am posting this as an answer to make it more obvious. I got that from @jechterhoff comment. Please vote him up.

Paulo Pedroso
  • 3,555
  • 2
  • 29
  • 34