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 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