From 951aba3843d0334fc8d6d06cda6c5540b8861b94 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 29 Oct 2022 17:47:04 +0200 Subject: [PATCH 1/2] [MRELEASE-1108] Upgrade Maven SCM to 2.0.0-M3 This closes #157 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba681be4..673652ae6 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ - 2.0.0-M2 + 2.0.0-M3 8 3.2.5 1.0.0.v20140518 From 0615a4c3b2138116a255fc2b57fcf83d76d49e68 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Sat, 6 Nov 2021 11:53:16 +0100 Subject: [PATCH 2/2] [MRELEASE-1072] Reuse original tag for next development version in case translator does not support resolution This closes #86 --- .../phase/RewritePomsForDevelopmentPhase.java | 14 +++++++- .../RewritePomsForDevelopmentPhaseTest.java | 20 +++++++++++ .../expected-pom.xml | 35 +++++++++++++++++++ .../basic-pom-with-svn-from-tag/pom.xml | 35 +++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/expected-pom.xml create mode 100644 maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/pom.xml diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java index b9914c726..a18889009 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java @@ -80,7 +80,19 @@ protected void transformScm( MavenProject project, Model modelTarget, ReleaseDes scmRoot.setConnection( scm.getConnection() ); scmRoot.setDeveloperConnection( scm.getDeveloperConnection() ); scmRoot.setUrl( scm.getUrl() ); - scmRoot.setTag( translator.resolveTag( scm.getTag() ) ); + String tag = translator.resolveTag( scm.getTag() ); + // reuse unresolved tag from original in case ScmTranslator does not support tags + if ( tag == null ) + { + tag = scm.getTag(); + // never give out default value as there is no way to distinguish it from an the + // explicitly set tag with the same value + if ( "HEAD".equals( tag ) ) + { + tag = null; + } + } + scmRoot.setTag( tag ); } else { diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java index 476cf0427..c96f583fd 100644 --- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java +++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java @@ -292,6 +292,26 @@ public void testRewriteBasicPomWithGitFromTag() assertTrue( comparePomFiles( reactorProjects ) ); } + @Test + public void testRewriteBasicPomWithSvnFromTag() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-svn-from-tag" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-svn-from-tag" ); + mapNextVersion( builder, "groupId:artifactId" ); + + Scm scm = new Scm(); + scm.setConnection( "scm:svn:file://localhost/svnroot/trunk/" ); + scm.setDeveloperConnection( "scm:svn:file://localhost/svnroot/trunk/" ); + scm.setUrl( "http://localhost/svn" ); + scm.setTag( "trunk" ); + builder.addOriginalScmInfo( "groupId:artifactId", scm ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + @Test public void testRewriteBasicPomWithInheritedScm() throws Exception diff --git a/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/expected-pom.xml b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/expected-pom.xml new file mode 100644 index 000000000..712373e50 --- /dev/null +++ b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/expected-pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + 3.2.5 + + + + scm:svn:file://localhost/svnroot/trunk/ + scm:svn:file://localhost/svnroot/trunk/ + http://localhost/svn + trunk + + \ No newline at end of file diff --git a/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/pom.xml b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/pom.xml new file mode 100644 index 000000000..a5d292b9e --- /dev/null +++ b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-svn-from-tag/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 3.2.5 + + + + scm:svn:file://localhost/svnroot/trunk/ + scm:svn:file://localhost/svnroot/trunk/ + http://localhost/svn + trunk + + \ No newline at end of file