This is an automated email from the ASF dual-hosted git repository.
slawekjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-release.git
The following commit(s) were added to refs/heads/master by this push:
new a4be6dd8 Add tag parameter to release:perform
a4be6dd8 is described below
commit a4be6dd8951b1f0c7828ae826b8e502eceaf17ea
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Sun Nov 22 13:09:13 2026 +0100
Add tag parameter to release:perform
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../it/projects/perform/gh-1040/invoker.properties | 18 ++++++++
.../src/it/projects/perform/gh-1040/pom.xml | 51 ++++++++++++++++++++++
.../perform/gh-1040/tags/gh-1040-1.0/pom.xml} | 22 +++-------
.../it/projects/perform/gh-1040/test.properties | 18 ++++++++
.../src/it/projects/perform/gh-1040/verify.groovy | 27 ++++++++++++
.../maven/plugins/release/PerformReleaseMojo.java | 12 +++++
.../src/site/markdown/usage/perform-release.md.vm | 6 +++
.../plugins/release/PerformReleaseMojoTest.java | 1 +
.../resources/mojos/perform/perform-with-scm.xml | 1 +
9 files changed, 141 insertions(+), 15 deletions(-)
diff --git
a/maven-release-plugin/src/it/projects/perform/gh-1040/invoker.properties
b/maven-release-plugin/src/it/projects/perform/gh-1040/invoker.properties
new file mode 100644
index 00000000..bba7cde0
--- /dev/null
+++ b/maven-release-plugin/src/it/projects/perform/gh-1040/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = release:perform -Dtag=gh-1040-1.0
diff --git a/maven-release-plugin/src/it/projects/perform/gh-1040/pom.xml
b/maven-release-plugin/src/it/projects/perform/gh-1040/pom.xml
new file mode 100644
index 00000000..3f6d4ce0
--- /dev/null
+++ b/maven-release-plugin/src/it/projects/perform/gh-1040/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugin.release.its</groupId>
+ <artifactId>gh-1040</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <url>https://github.com/apache/maven-release/issues/1040</url>
+ <description>Perform a release from the tag given by the tag
parameter</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>@project.version@</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.release</groupId>
+ <artifactId>maven-scm-provider-stub</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <connectionUrl>scm:stub|trunk</connectionUrl>
+ <goals>validate</goals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
b/maven-release-plugin/src/it/projects/perform/gh-1040/tags/gh-1040-1.0/pom.xml
similarity index 65%
copy from
maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
copy to
maven-release-plugin/src/it/projects/perform/gh-1040/tags/gh-1040-1.0/pom.xml
index 9d324323..4ae77aed 100644
--- a/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
+++
b/maven-release-plugin/src/it/projects/perform/gh-1040/tags/gh-1040-1.0/pom.xml
@@ -17,19 +17,11 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <workingDirectory>${basedir}/target/checkout</workingDirectory>
- <useReleaseProfile>true</useReleaseProfile>
- <connectionUrl>scm-url</connectionUrl>
- <goals>deploy site-deploy</goals>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+ <groupId>org.apache.maven.plugin.release.its</groupId>
+ <artifactId>gh-1040</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+</project>
diff --git
a/maven-release-plugin/src/it/projects/perform/gh-1040/test.properties
b/maven-release-plugin/src/it/projects/perform/gh-1040/test.properties
new file mode 100644
index 00000000..22dc9784
--- /dev/null
+++ b/maven-release-plugin/src/it/projects/perform/gh-1040/test.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+dryRun=false
diff --git a/maven-release-plugin/src/it/projects/perform/gh-1040/verify.groovy
b/maven-release-plugin/src/it/projects/perform/gh-1040/verify.groovy
new file mode 100644
index 00000000..146adbcd
--- /dev/null
+++ b/maven-release-plugin/src/it/projects/perform/gh-1040/verify.groovy
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import groovy.xml.XmlSlurper
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+assert buildLog.text.contains( "Checking out: " + new File( basedir,
'tags/gh-1040-1.0' ).absolutePath )
+
+def pom = new XmlSlurper().parse( new File( basedir, 'target/checkout/pom.xml'
) )
+assert pom.version.text() == '1.0'
diff --git
a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
index 0e5fbaf6..6362b816 100644
---
a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
+++
b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
@@ -73,6 +73,15 @@ public class PerformReleaseMojo extends
AbstractScmReadReleaseMojo {
@Parameter(property = "connectionUrl")
private String connectionUrl;
+ /**
+ * The SCM tag to checkout. Required for SCMs like Git, where the tag
cannot be part of the
+ * <code>connectionUrl</code>. A tag stored in the
<code>release.properties</code> file takes precedence.
+ *
+ * @since 3.4.0
+ */
+ @Parameter(property = "tag")
+ private String tag;
+
/**
* Use a local checkout instead of doing a checkout from the upstream
repository.
* ATTENTION: This will only work with distributed SCMs which support the
file:// protocol
@@ -133,6 +142,9 @@ public class PerformReleaseMojo extends
AbstractScmReadReleaseMojo {
if (connectionUrl != null) {
releaseDescriptor.setScmSourceUrl(connectionUrl);
}
+ if (tag != null) {
+ releaseDescriptor.setScmReleaseLabel(tag);
+ }
releaseDescriptor.setLocalCheckout(localCheckout);
diff --git a/maven-release-plugin/src/site/markdown/usage/perform-release.md.vm
b/maven-release-plugin/src/site/markdown/usage/perform-release.md.vm
index ecafb480..7141397c 100644
--- a/maven-release-plugin/src/site/markdown/usage/perform-release.md.vm
+++ b/maven-release-plugin/src/site/markdown/usage/perform-release.md.vm
@@ -46,6 +46,12 @@ This relies on `release.properties` being present from a
previous release prepar
mvn org.apache.maven.plugins:maven-release-plugin:${project.version}:perform
-DconnectionUrl=scm:svn:https://svn.mycompany.com/repos/path/to/myproject/tags/myproject-1.2.3
```
+For SCMs like Git, where the tag cannot be part of the URL, give the tag with
the `tag` parameter:
+
+```
+mvn org.apache.maven.plugins:maven-release-plugin:${project.version}:perform
-DconnectionUrl=scm:git:https://git.mycompany.com/repos/path/to/myproject.git
-Dtag=myproject-1.2.3
+```
+
`release:perform` will fork a new Maven instance to build the checked-out
project. This new Maven instance will use the same system configuration and
Maven profiles used by the one running the `release:perform` goal. Since
there's no pom.xml, you should use the fully qualified name of the goal to
ensure the right version of the maven-release-plugin is used.
It is possible to force some profiles to get enabled during release (for
example to enable time-consuming tasks that are only relevant at release-time)
by setting a comma separated list of profiles names in the `releaseProfiles`
parameter. The goals and profiles required to release the project can then be
configured in the POM:
diff --git
a/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
b/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
index 89db9f1b..886dde85 100644
---
a/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
+++
b/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java
@@ -244,6 +244,7 @@ class PerformReleaseMojoTest {
argument.getValue().getReleaseDescriptorBuilder().build();
assertEquals("deploy site-deploy",
releaseDescriptor.getPerformGoals());
assertEquals("scm-url", releaseDescriptor.getScmSourceUrl());
+ assertEquals("scm-tag", releaseDescriptor.getScmReleaseLabel());
verifyNoMoreInteractions(releaseManagerMock);
}
diff --git
a/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
b/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
index 9d324323..c964c2e2 100644
--- a/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
+++ b/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml
@@ -27,6 +27,7 @@ under the License.
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<useReleaseProfile>true</useReleaseProfile>
<connectionUrl>scm-url</connectionUrl>
+ <tag>scm-tag</tag>
<goals>deploy site-deploy</goals>
</configuration>
</plugin>