[ https://issues.apache.org/jira/browse/MRELEASE-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16233680#comment-16233680 ]
ASF GitHub Bot commented on MRELEASE-980: ----------------------------------------- hboutemy closed pull request #13: MRELEASE-980 Allow commit comments to be controlled URL: https://github.com/apache/maven-release/pull/13 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/maven-release-manager/src/main/components-fragment.xml b/maven-release-manager/src/main/components-fragment.xml index 5880c75f..97eca406 100644 --- a/maven-release-manager/src/main/components-fragment.xml +++ b/maven-release-manager/src/main/components-fragment.xml @@ -152,7 +152,7 @@ </requirement> </requirements> <configuration> - <messageFormat>prepare release {0}</messageFormat> + <descriptorCommentGetter>getScmReleaseCommitComment</descriptorCommentGetter> </configuration> </component> <component> @@ -165,7 +165,7 @@ </requirement> </requirements> <configuration> - <messageFormat>prepare for next development iteration</messageFormat> + <descriptorCommentGetter>getScmDevelopmentCommitComment</descriptorCommentGetter> <rollbackMessageFormat>rollback changes from release preparation of {0}</rollbackMessageFormat> </configuration> </component> @@ -179,7 +179,7 @@ </requirement> </requirements> <configuration> - <messageFormat>prepare branch {0}</messageFormat> + <descriptorCommentGetter>getScmBranchCommitComment</descriptorCommentGetter> </configuration> </component> <component> @@ -192,7 +192,7 @@ </requirement> </requirements> <configuration> - <messageFormat>rollback the release of {0}</messageFormat> + <descriptorCommentGetter>getScmRollbackCommitComment</descriptorCommentGetter> </configuration> </component> <component> diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java index 235517b6..559a4921 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java @@ -211,6 +211,22 @@ public void write( ReleaseDescriptor config, File file ) { properties.setProperty( "scm.commentPrefix", config.getScmCommentPrefix() ); } + if ( config.getScmDevelopmentCommitComment() != null ) + { + properties.setProperty( "scm.developmentCommitComment", config.getScmDevelopmentCommitComment() ); + } + if ( config.getScmReleaseCommitComment() != null ) + { + properties.setProperty( "scm.releaseCommitComment", config.getScmReleaseCommitComment() ); + } + if ( config.getScmBranchCommitComment() != null ) + { + properties.setProperty( "scm.branchCommitComment", config.getScmBranchCommitComment() ); + } + if ( config.getScmRollbackCommitComment() != null ) + { + properties.setProperty( "scm.rollbackCommitComment", config.getScmRollbackCommitComment() ); + } if ( config.getAdditionalArguments() != null ) { properties.setProperty( "exec.additionalArguments", config.getAdditionalArguments() ); diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java index 522fef4a..5dca5b8a 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java @@ -69,6 +69,16 @@ public static ReleaseDescriptor merge( ReleaseDescriptor mergeInto, ReleaseDescr mergeOverride( mergeInto.getScmPrivateKeyPassPhrase(), toBeMerged.getScmPrivateKeyPassPhrase() ) ); mergeInto.setScmCommentPrefix( mergeOverride( mergeInto.getScmCommentPrefix(), toBeMerged.getScmCommentPrefix() ) ); + mergeInto.setScmDevelopmentCommitComment( + mergeOverride( + mergeInto.getScmDevelopmentCommitComment(), + toBeMerged.getScmDevelopmentCommitComment() ) ); + mergeInto.setScmReleaseCommitComment( + mergeOverride( mergeInto.getScmReleaseCommitComment(), toBeMerged.getScmReleaseCommitComment() ) ); + mergeInto.setScmBranchCommitComment( + mergeOverride( mergeInto.getScmBranchCommitComment(), toBeMerged.getScmBranchCommitComment() ) ); + mergeInto.setScmRollbackCommitComment( + mergeOverride( mergeInto.getScmRollbackCommitComment(), toBeMerged.getScmRollbackCommitComment() ) ); mergeInto.setAdditionalArguments( mergeOverride( mergeInto.getAdditionalArguments(), toBeMerged.getAdditionalArguments() ) ); mergeInto.setPreparationGoals( @@ -158,6 +168,23 @@ public static ReleaseDescriptor copyPropertiesToReleaseDescriptor( Properties pr releaseDescriptor.setScmBranchBase( properties.getProperty( "scm.branchBase" ) ); releaseDescriptor.setScmReleaseLabel( properties.getProperty( "scm.tag" ) ); releaseDescriptor.setScmCommentPrefix( properties.getProperty( "scm.commentPrefix" ) ); + if ( properties.getProperty( "scm.releaseCommitComment" ) != null ) + { + releaseDescriptor.setScmReleaseCommitComment( properties.getProperty( "scm.releaseCommitComment" ) ); + } + if ( properties.getProperty( "scm.developmentCommitComment" ) != null ) + { + releaseDescriptor.setScmDevelopmentCommitComment( + properties.getProperty( "scm.developmentCommitComment" ) ); + } + if ( properties.getProperty( "scm.branchCommitComment" ) != null ) + { + releaseDescriptor.setScmBranchCommitComment( properties.getProperty( "scm.branchCommitComment" ) ); + } + if ( properties.getProperty( "scm.rollbackCommitComment" ) != null ) + { + releaseDescriptor.setScmRollbackCommitComment( properties.getProperty( "scm.rollbackCommitComment" ) ); + } releaseDescriptor.setAdditionalArguments( properties.getProperty( "exec.additionalArguments" ) ); releaseDescriptor.setPomFileName( properties.getProperty( "exec.pomFileName" ) ); releaseDescriptor.setPreparationGoals( properties.getProperty( "preparationGoals" ) ); diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java index 990060d7..e67fd267 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java @@ -39,7 +39,6 @@ import org.apache.maven.shared.release.util.ReleaseUtil; import java.io.File; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -63,9 +62,9 @@ protected ScmRepositoryConfigurator scmRepositoryConfigurator; /** - * The format for the commit message. + * The getter in the descriptor for the comment. */ - protected String messageFormat; + protected String descriptorCommentGetter; public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List<MavenProject> reactorProjects ) @@ -186,10 +185,47 @@ protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) } } - protected String createMessage( ReleaseDescriptor releaseDescriptor ) + protected String createMessage( List<MavenProject> reactorProjects, + ReleaseDescriptor releaseDescriptor ) + throws ReleaseExecutionException { - return MessageFormat.format( releaseDescriptor.getScmCommentPrefix() + messageFormat, - new Object[]{releaseDescriptor.getScmReleaseLabel()} ); + String comment; + boolean branch = false; + if ( "getScmReleaseCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmReleaseCommitComment(); + } + else if ( "getScmDevelopmentCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmDevelopmentCommitComment(); + } + else if ( "getScmBranchCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmBranchCommitComment(); + branch = true; + } + else if ( "getScmRollbackCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmRollbackCommitComment(); + } + else + { + throw new ReleaseExecutionException( "Invalid configuration in components-fragment.xml" ); + } + + MavenProject project = ReleaseUtil.getRootProject( reactorProjects ); + comment = comment.replace( "@{prefix}", releaseDescriptor.getScmCommentPrefix().trim() ); + comment = comment.replace( "@{groupId}", project.getGroupId() ); + comment = comment.replace( "@{artifactId}", project.getArtifactId() ); + if ( branch ) + { + comment = comment.replace( "@{branchName}", releaseDescriptor.getScmReleaseLabel() ); + } + else + { + comment = comment.replace( "@{releaseLabel}", releaseDescriptor.getScmReleaseLabel() ); + } + return comment; } protected static List<File> createPomFiles( ReleaseDescriptor releaseDescriptor, MavenProject project ) diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java index 889b9c35..a1fc956e 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java @@ -78,13 +78,13 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment else { // a normal commit - message = createMessage( releaseDescriptor ); + message = createMessage( reactorProjects, releaseDescriptor ); } if ( simulating ) { Collection<File> pomFiles = createPomFiles( releaseDescriptor, reactorProjects ); logInfo( result, - "Full run would be commit " + pomFiles.size() + " files with message: '" + message + "'" ); + "Full run would commit " + pomFiles.size() + " files with message: '" + message + "'" ); } else { diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java index 8c65a60a..1bee2fb4 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java @@ -28,7 +28,6 @@ import org.apache.maven.shared.release.scm.ReleaseScmCommandException; import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; -import java.text.MessageFormat; import java.util.List; /** @@ -40,11 +39,6 @@ extends AbstractScmCommitPhase { - /** - * The format for the - */ - private String rollbackMessageFormat; - protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List<MavenProject> reactorProjects, ReleaseResult result, boolean simulating ) throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException @@ -65,8 +59,7 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment // commit development versions required else { - String message = createMessage( releaseDescriptor ); - + String message = createMessage( reactorProjects, releaseDescriptor ); if ( simulating ) { simulateCheckins( releaseDescriptor, reactorProjects, result, message ); @@ -78,12 +71,6 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment } } - private String createRollbackMessage( ReleaseDescriptor releaseDescriptor ) - { - return MessageFormat.format( releaseDescriptor.getScmCommentPrefix() + rollbackMessageFormat, - new Object[]{releaseDescriptor.getScmReleaseLabel()} ); - } - protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) throws ReleaseFailureException { diff --git a/maven-release-manager/src/main/mdo/release-descriptor.mdo b/maven-release-manager/src/main/mdo/release-descriptor.mdo index f62b0ffd..c8defbc7 100644 --- a/maven-release-manager/src/main/mdo/release-descriptor.mdo +++ b/maven-release-manager/src/main/mdo/release-descriptor.mdo @@ -69,6 +69,42 @@ </description> </field> <field> + <name>scmReleaseCommitComment</name> + <version>3.0.0+</version> + <type>String</type> + <defaultValue>@{prefix} prepare release @{releaseLabel}</defaultValue> + <description> + The SCM commit comment when setting pom.xml to release + </description> + </field> + <field> + <name>scmDevelopmentCommitComment</name> + <version>3.0.0+</version> + <type>String</type> + <defaultValue>@{prefix} prepare for next development iteration</defaultValue> + <description> + The SCM commit comment when setting pom.xml back to development + </description> + </field> + <field> + <name>scmBranchCommitComment</name> + <version>3.0.0+</version> + <type>String</type> + <defaultValue>@{prefix} prepare branch @{releaseLabel}</defaultValue> + <description> + The SCM commit comment when branching + </description> + </field> + <field> + <name>scmRollbackCommitComment</name> + <version>3.0.0+</version> + <type>String</type> + <defaultValue>@{prefix} rollback the release of @{releaseLabel}</defaultValue> + <description> + The SCM commit comment when rolling back + </description> + </field> + <field> <name>scmSourceUrl</name> <version>1.0.0+</version> <type>String</type> @@ -793,6 +829,22 @@ { return false; } + if ( !safeEquals( scmDevelopmentCommitComment, that.scmDevelopmentCommitComment ) ) + { + return false; + } + if ( !safeEquals( scmReleaseCommitComment, that.scmReleaseCommitComment ) ) + { + return false; + } + if ( !safeEquals( scmBranchCommitComment, that.scmBranchCommitComment ) ) + { + return false; + } + if ( !safeEquals( scmRollbackCommitComment, that.scmRollbackCommitComment ) ) + { + return false; + } if ( !safeEquals( scmPrivateKeyPassPhrase, that.scmPrivateKeyPassPhrase ) ) { return false; @@ -921,6 +973,10 @@ result = 29 * result + ( completionGoals != null ? completionGoals.hashCode() : 0 ); result = 29 * result + ( pomFileName != null ? pomFileName.hashCode() : 0 ); result = 29 * result + ( checkModificationExcludes != null ? checkModificationExcludes.hashCode() : 0 ); + result = 29 * result + ( scmDevelopmentCommitComment != null ? scmDevelopmentCommitComment.hashCode() : 0 ); + result = 29 * result + ( scmReleaseCommitComment != null ? scmReleaseCommitComment.hashCode() : 0 ); + result = 29 * result + ( scmBranchCommitComment != null ? scmBranchCommitComment.hashCode() : 0 ); + result = 29 * result + ( scmRollbackCommitComment != null ? scmRollbackCommitComment.hashCode() : 0 ); result = 29 * result + ( scmTagBase != null ? scmTagBase.hashCode() : 0 ); result = 29 * result + ( scmBranchBase != null ? scmBranchBase.hashCode() : 0 ); result = 29 * result + ( scmUsername != null ? scmUsername.hashCode() : 0 ); diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java index 56875c0a..14f99938 100644 --- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java +++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java @@ -118,6 +118,21 @@ public void testCommitsNextVersions() } @Test + public void testCommitsNextVersionsAlternateMessage() + throws Exception + { + descriptor.setUpdateWorkingCopyVersions( true ); + descriptor.setScmCommentPrefix("[release]"); + descriptor.setScmDevelopmentCommitComment("@{prefix} Development of @{groupId}:@{artifactId}"); + + prepareCheckin( "[release] Development of groupId:artifactId" ); + + phase.execute( descriptor, new DefaultReleaseEnvironment(), reactorProjects ); + + verifyCheckin( "[release] Development of groupId:artifactId" ); + } + + @Test public void testCommitsRollbackPrepare() throws Exception { diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java index 9cc7256c..ec825074 100644 --- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java +++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java @@ -129,6 +129,41 @@ public void testCommit() } @Test + public void testCommitAlternateMessage() + throws Exception + { + // prepare + List<MavenProject> reactorProjects = createReactorProjects(); + ReleaseDescriptor descriptor = new ReleaseDescriptor(); + descriptor.setScmSourceUrl( "scm-url" ); + descriptor.setScmCommentPrefix("[release]"); + descriptor.setScmReleaseCommitComment("@{prefix} Release of @{groupId}:@{artifactId} @{releaseLabel}"); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + descriptor.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + descriptor.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Release of groupId:artifactId release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( descriptor, new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( "[release] Release of groupId:artifactId release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test public void testCommitMultiModule() throws Exception { @@ -204,6 +239,44 @@ public void testCommitDevelopment() } @Test + public void testCommitDevelopmentAlternateMessage() + throws Exception + { + // prepare + phase = (ReleasePhase) lookup( ReleasePhase.ROLE, "scm-commit-development" ); + + ReleaseDescriptor descriptor = new ReleaseDescriptor(); + List<MavenProject> reactorProjects = createReactorProjects(); + descriptor.setScmSourceUrl( "scm-url" ); + descriptor.setScmCommentPrefix("[release]"); + descriptor.setScmDevelopmentCommitComment("@{prefix} Bump version of @{groupId}:@{artifactId} after @{releaseLabel}"); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + descriptor.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + descriptor.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Bump version of groupId:artifactId after release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( descriptor, new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Bump version of groupId:artifactId after release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test public void testCommitNoReleaseLabel() throws Exception { 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 03aa31be..9884334a 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 @@ -207,6 +207,25 @@ private String projectNamingPolicyId; /** + * The SCM commit comment when branching. + * Defaults to "@{prefix} prepare branch @{releaseLabel}". + * <p> + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use <code>@{...}</code> to reference the properties rather than <code>${...}</code>. + * The following properties are available: + * <ul> + * <li><code>prefix</code> - The comment prefix. + * <li><code>groupId</code> - The groupId of the root project. + * <li><code>artifactId</code> - The artifactId of the root project. + * <li><code>releaseLabel</code> - The release version of the root project. + * </ul> + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "@{prefix} prepare branch @{releaseLabel}", property = "scmBranchCommitComment" ) + private String scmBranchCommitComment = "@{prefix} prepare branch @{releaseLabel}"; + + /** * {@inheritDoc} */ public void execute() @@ -231,6 +250,7 @@ public void execute() config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeBranch ); config.setProjectVersionPolicyId( projectVersionPolicyId ); config.setProjectNamingPolicyId( projectNamingPolicyId ); + config.setScmBranchCommitComment( scmBranchCommitComment ); // Create a config containing values from the session properties (ie command line properties with cli). ReleaseDescriptor sysPropertiesConfig diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java index 852f61cd..a0ae3b2d 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java @@ -234,6 +234,46 @@ private String projectNamingPolicyId; /** + * The SCM commit comment when setting pom.xml to release. + * Defaults to "@{prefix} prepare release @{releaseLabel}". + * <p> + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use <code>@{...}</code> to reference the properties rather than <code>${...}</code>. + * The following properties are available: + * <ul> + * <li><code>prefix</code> - The comment prefix. + * <li><code>groupId</code> - The groupId of the root project. + * <li><code>artifactId</code> - The artifactId of the root project. + * <li><code>releaseLabel</code> - The release version of the root project. + * </ul> + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "@{prefix} prepare release @{releaseLabel}", property = "scmReleaseCommitComment" ) + private String scmReleaseCommitComment = "@{prefix} prepare release @{releaseLabel}"; + + /** + * The SCM commit comment when setting pom.xml back to development. + * Defaults to "@{prefix} prepare for next development iteration". + * <p> + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use <code>@{...}</code> to reference the properties rather than <code>${...}</code>. + * The following properties are available: + * <ul> + * <li><code>prefix</code> - The comment prefix. + * <li><code>groupId</code> - The groupId of the root project. + * <li><code>artifactId</code> - The artifactId of the root project. + * <li><code>releaseLabel</code> - The release version of the root project. + * </ul> + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} prepare for next development iteration", + property = "scmDevelopmentCommitComment" ) + private String scmDevelopmentCommitComment = "@{prefix} prepare for next development iteration"; + + /** * {@inheritDoc} */ public void execute() @@ -274,6 +314,8 @@ protected void prepareRelease( boolean generateReleasePoms ) config.setWaitBeforeTagging( waitBeforeTagging ); config.setProjectVersionPolicyId( projectVersionPolicyId ); config.setProjectNamingPolicyId( projectNamingPolicyId ); + config.setScmDevelopmentCommitComment( scmDevelopmentCommitComment ); + config.setScmReleaseCommitComment( scmReleaseCommitComment ); if ( checkModificationExcludeList != null ) { diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java index fd0cad07..2fc60d29 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java @@ -22,6 +22,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.config.ReleaseDescriptor; @@ -42,6 +43,27 @@ { /** + * The SCM commit comment when rolling back. + * Defaults to "@{prefix} rollback the release of @{releaseLabel}". + * <p> + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use <code>@{...}</code> to reference the properties rather than <code>${...}</code>. + * The following properties are available: + * <ul> + * <li><code>prefix</code> - The comment prefix. + * <li><code>groupId</code> - The groupId of the root project. + * <li><code>artifactId</code> - The artifactId of the root project. + * <li><code>releaseLabel</code> - The release version of the root project. + * </ul> + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} rollback the release of @{releaseLabel}", + property = "scmRollbackCommitComment" ) + private String scmRollbackCommitComment = "@{prefix} rollback the release of @{releaseLabel}"; + + /** * {@inheritDoc} */ public void execute() @@ -50,6 +72,7 @@ public void execute() super.execute(); ReleaseDescriptor config = createReleaseDescriptor(); + config.setScmRollbackCommitComment( scmRollbackCommitComment ); try { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Provide the ability to control commit messages > ---------------------------------------------- > > Key: MRELEASE-980 > URL: https://issues.apache.org/jira/browse/MRELEASE-980 > Project: Maven Release Plugin > Issue Type: Improvement > Components: prepare > Affects Versions: 2.5.3 > Reporter: Stephen Colebourne > Priority: Major > Fix For: 3.0.0 > > > The commit messages used by maven-release-plugin are rather ugly to my eyes. > While the comment prefix provides some control, what is really needed is to > be able to change the whole message from xml configuration. > I've implemented this here: > https://github.com/jodastephen/maven-release/commit/35b2a50900cfc8e8fca88a94e46985a09e538e86 > (all rights granted to Apache - I'm still a committer at Apache Commons. > It adds four new properties that allow the commit message to be controlled at > various points. The commit message can be configured using `@{}` style > inserts. There are more messages that could be controlled, but these were all > I needed. > Note that issue MRELEASE-706 originally requested this feature, but it was > closed due to inactivity. -- This message was sent by Atlassian JIRA (v6.4.14#64029)