Search code examples
gitmavenrollbackmaven-release-plugingit-tag

get mvn release:rollback to delete tag in GIT


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>

Solution

  • 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.