How to run release:perform from a given Git tag?

2020-03-01 05:10发布

问题:

Due to issues with a Nexus staging repository, I need to re-run mvn release:perform, ideally without creating a new Git tag but reusing the one created by the first run.

I tried

mvn release:perform
-DconnectionUrl=scm:git:git@github.com:ops4j/org.ops4j.pax.exam2.git 
-Dtag=exam-reactor-3.3.0

and

mvn release:perform
-DconnectionUrl=scm:git:git@github.com:ops4j/org.ops4j.pax.exam2.git 
-Dscm.tag=exam-reactor-3.3.0

but in both cases, the clone fails because the tag/branch parameter is not forwarded to Git:

[INFO] --- maven-release-plugin:2.4:perform (default-cli) @ exam-reactor ---
[INFO] Checking out the project to perform the release ...
[INFO] Executing: /bin/sh -c cd /home/hwellmann/work/org.ops4j.pax.exam2/target && git clone --branch git@github.com:ops4j/org.ops4j.pax.exam2.git /home/hwellmann/work/org.ops4j.pax.exam2/target/checkout

Note: release.properties and other stuff created by mvn release:prepare is no longer available.

回答1:

This issue is filed as SCM-729, and currently unresolved. In the meantime, you might consider a workaround.

The simplest is to forget about maven-release-plugin; clone, check out that tag and then run mvn deploy.

Alternatively, you can use release:perform with a manually edited release.properties file. Set scm.tag and scm.url and then run release:perform.