From 6da9fbe80d983d640dcc64604915d68bde6d60d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 28 May 2022 22:13:53 +0200 Subject: [PATCH] [MRELEASE-1079] restore test as it was before MRELEASE-998 --- .../shared/release/config/ReleaseDescriptor.java | 11 ++++++++++- .../release/phase/RewritePomsForBranchPhase.java | 2 +- .../release/phase/RewritePomsForReleasePhase.java | 2 +- .../src/main/mdo/release-descriptor.mdo | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java b/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java index 48ff5ac97..6ca7c0f01 100644 --- a/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java +++ b/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java @@ -485,11 +485,20 @@ public interface ReleaseDescriptor /** *

getOriginalScmInfo.

* - * @return the original {@code Scm} information. * @param projectKey the project key {@code String} + * @return the original {@code Scm} information. */ Scm getOriginalScmInfo( String projectKey ); + /** + *

hasOriginalScmInfo.

+ * + * @param projectKey the project key {@code String} + * @return has original Scm info. + */ + boolean hasOriginalScmInfo( String projectKey ); + + // Modifiable /** *

addDependencyOriginalVersion.

diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java index 20893f72f..b66f685a9 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java @@ -96,7 +96,7 @@ protected void transformScm( MavenProject project, Model modelTarget, ReleaseDes // If the SCM element is not present, only add it if the parent was not mapped (ie, it's external to // the release process and so has not been modified, so the values will not be correct on the tag), String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() ); - if ( releaseDescriptor.getOriginalScmInfo( parentId ) == null ) + if ( !releaseDescriptor.hasOriginalScmInfo( parentId ) ) { // we need to add it, since it has changed from the inherited value scmRoot = new Scm(); diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java index fa7df3211..2217d919f 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java @@ -95,7 +95,7 @@ protected void transformScm( MavenProject project, Model modelTarget, ReleaseDes // If the SCM element is not present, only add it if the parent was not mapped (ie, it's external to // the release process and so has not been modified, so the values will not be correct on the tag), String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() ); - if ( releaseDescriptor.getOriginalScmInfo( parentId ) == null ) + if ( !releaseDescriptor.hasOriginalScmInfo( parentId ) ) { // we need to add it, since it has changed from the inherited value Scm scmTarget = new Scm(); diff --git a/maven-release-manager/src/main/mdo/release-descriptor.mdo b/maven-release-manager/src/main/mdo/release-descriptor.mdo index 871637ace..32dfa060a 100644 --- a/maven-release-manager/src/main/mdo/release-descriptor.mdo +++ b/maven-release-manager/src/main/mdo/release-descriptor.mdo @@ -719,13 +719,23 @@ /** * Method getOriginalScmInfo. * - * @return Map + * @return Scm */ public org.apache.maven.model.Scm getOriginalScmInfo( String id ) { return this.originalScmInfo.get( id ); - } //-- java.util.Map getOriginalScmInfo() + } //-- Scm getOriginalScmInfo( String) + /** + * Method hasOriginalScmInfo. + * + * @return map contains + */ + public boolean hasOriginalScmInfo( String id ) + { + return this.originalScmInfo.containsKey( id ); + } //-- boolean hasOriginalScmInfo( String ) + /** * Method addOriginalScmInfo. *