From f3bbb7769da79cce175cf1e9b47a617e56195753 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Thu, 13 Jun 2024 22:13:54 +0200 Subject: [PATCH] [MRELEASE-1064] [REGRESSION] release:branch uses @releaseLabel instead of @branchName in default SCM commit This closes #221 --- .../branch/MRELEASE-458/verify.groovy | 21 +++++++++++-------- .../branch/MRELEASE-694/verify.groovy | 7 ++++++- .../branch/MRELEASE-976/verify.groovy | 5 +++++ .../plugins/release/BranchReleaseMojo.java | 8 +++---- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.groovy b/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.groovy index 010e552f1..9eb79ca0a 100644 --- a/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.groovy +++ b/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.groovy @@ -6,9 +6,9 @@ * 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 @@ -17,12 +17,15 @@ * under the License. */ +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch test-1.0.x'") + try -{ - File buildLog = new File( basedir, "build.log" ); - +{ System.out.println( "Checking logs..." ); - + StringBuffer data = new StringBuffer( 1024 ); BufferedReader reader = new BufferedReader( new FileReader( buildLog ) ); char[] buf = new char[1024]; @@ -37,13 +40,13 @@ try String contents = data.toString(); String one_expected = "Checking in modified POMs"; - + int pos = contents.indexOf( one_expected ); - + if( contents.indexOf( one_expected, pos ) == -1 ) { return true; - } + } } catch( Throwable t ) { diff --git a/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy b/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy index 663166f1a..3514168cf 100644 --- a/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy +++ b/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy @@ -20,10 +20,15 @@ import groovy.xml.XmlSlurper +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch RELEASE-2.6.0'") + def projectBranch = new XmlSlurper().parse( new File( basedir, "pom.xml.branch" ) ) assert projectBranch.version.text() == "2.6.0-BRANCH-SNAPSHOT" def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) assert projectNext.version.text() == "2.6.1-DEV-SNAPSHOT" -return true \ No newline at end of file +return true diff --git a/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy b/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy index b7de67c33..93aaa8228 100644 --- a/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy +++ b/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy @@ -27,4 +27,9 @@ assert project.version.text() == "1.0-SNAPSHOT" def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) assert projectNext.version.text() == "1.0-SNAPSHOT" +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch branch-mrelease-976'") + return true diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java index db314c4b0..f0eb8cc4c 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java @@ -218,7 +218,7 @@ public class BranchReleaseMojo extends AbstractScmReleaseMojo { /** * The SCM commit comment when branching. - * Defaults to "@{prefix} prepare branch @{releaseLabel}". + * Defaults to "@{prefix} prepare branch @{branchName}". *

* Property interpolation is performed on the value, but in order to ensure that the interpolation occurs * during release, you must use @{...} to reference the properties rather than ${...}. @@ -227,13 +227,13 @@ public class BranchReleaseMojo extends AbstractScmReleaseMojo { *

  • prefix - The comment prefix. *
  • groupId - The groupId of the root project. *
  • artifactId - The artifactId of the root project. - *
  • releaseLabel - The release version of the root project. + *
  • branchName - The branch name of the root project. * * * @since 3.0.0-M1 */ - @Parameter(defaultValue = "@{prefix} prepare branch @{releaseLabel}", property = "scmBranchCommitComment") - private String scmBranchCommitComment = "@{prefix} prepare branch @{releaseLabel}"; + @Parameter(defaultValue = "@{prefix} prepare branch @{branchName}", property = "scmBranchCommitComment") + private String scmBranchCommitComment = "@{prefix} prepare branch @{branchName}"; /** * Currently only implemented with svn scm. Enable the {@code --pin-externals} option in