Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 588
Pearl Jade Avatar asked Jul 07 '15 10:07

Pearl Jade


2 Answers

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.

like image 158
nwinkler Avatar answered Sep 28 '22 07:09

nwinkler


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.

like image 34
Henrique Ordine Avatar answered Sep 28 '22 09:09

Henrique Ordine