maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r404734 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/phase/ test/resources/projects/rewrite-for-release/basic-pom/
Date Sun, 07 May 2006 06:52:56 GMT
Author: brett
Date: Sat May  6 23:52:54 2006
New Revision: 404734

URL: http://svn.apache.org/viewcvs?rev=404734&view=rev
Log:
workaround issue in JDOM

Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java?rev=404734&r1=404733&r2=404734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
Sat May  6 23:52:54 2006
@@ -38,11 +38,13 @@
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
+import org.jdom.Comment;
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.Namespace;
 import org.jdom.Text;
+import org.jdom.filter.ContentFilter;
 import org.jdom.filter.ElementFilter;
 import org.jdom.input.SAXBuilder;
 import org.jdom.output.Format;
@@ -116,6 +118,9 @@
             SAXBuilder builder = new SAXBuilder();
             document = builder.build( new StringReader( content ) );
 
+            // Normalise line endings. For some reason, JDOM replaces \r\n inside a comment
with \n.
+            normaliseLineEndings( document );
+
             // rewrite DOM as a string to find differences, since text outside the root element
is not tracked
             StringWriter w = new StringWriter();
             Format format = Format.getRawFormat();
@@ -168,6 +173,15 @@
         {
             writePom( project.getFile(), document, releaseConfiguration, project.getModelVersion(),
intro, outtro,
                       scmRepository, provider );
+        }
+    }
+
+    private void normaliseLineEndings( Document document )
+    {
+        for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT
) ); i.hasNext(); )
+        {
+            Comment c = (Comment) i.next();
+            c.setText( c.getText().replaceAll( "\n", LS ) );
         }
     }
 

Modified: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml?rev=404734&r1=404733&r2=404734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml
Sat May  6 23:52:54 2006
@@ -31,4 +31,9 @@
     <developerConnection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</developerConnection>
     <url>file://localhost/tmp/scm-repo/tags/release-label</url>
   </scm>
+
+  <!--
+  a multi-line
+  comment
+  -->
 </project>

Modified: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml?rev=404734&r1=404733&r2=404734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml
Sat May  6 23:52:54 2006
@@ -31,4 +31,9 @@
     <developerConnection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</developerConnection>
     <url>file://localhost/tmp/scm-repo/tags/release-label</url>
   </scm>
+
+  <!--
+  a multi-line
+  comment
+  -->
 </project>

Modified: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml?rev=404734&r1=404733&r2=404734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml
Sat May  6 23:52:54 2006
@@ -31,4 +31,9 @@
     <developerConnection>scm:svn:file://localhost/tmp/scm-repo/trunk</developerConnection>
     <url>file://localhost/tmp/scm-repo/trunk</url>
   </scm>
+
+  <!--
+  a multi-line
+  comment
+  -->
 </project>



Mime
View raw message