You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/01/05 06:59:22 UTC

[GitHub] [maven-archetype] newur opened a new pull request #35: ARCHETYPE-584 fix indention in root pom.xml

newur opened a new pull request #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35
 
 
   Problem: linebreaks + indentions (whitespaces) are read as actual document nodes. This causes problems in combination with
   ```
   tr.setOutputProperty( OutputKeys.INDENT, "yes" );
   tr.setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "2" );
   ```
   
   Removed the `.normalizeWhitespace()` in tests, because this shadowed the actual bug. Also split  one test into multiple tests. Test content remains the same.
   
   Had to add the **maven-4.0.0.xsd**, not sure if this is desired.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-archetype] softdays commented on issue #35: ARCHETYPE-584 fix indention in root pom.xml

Posted by GitBox <gi...@apache.org>.
softdays commented on issue #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35#issuecomment-590729539
 
 
   Any chance to get this PR merged?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-archetype] elharo commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35#discussion_r409776830
 
 

 ##########
 File path: archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
 ##########
 @@ -239,93 +250,118 @@ private ClassLoader getContextClassloader( Artifact archetypeArtifact, ArtifactR
         return archetypeJarLoader;
     }
 
-    public void testAddModuleToParentPOM()
-        throws Exception
+    public void testAddModuleToParentBasic()
+            throws Exception
     {
-        String pom = "<project>\n"
-            + "  <packaging>pom</packaging>\n"
-            + "</project>";
+        String pom = PROJECT_ELEMENT
+                + PACKAGING
+                + PROJECT_ELEMENT_END;
 
         StringWriter out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId1", new StringReader( pom ), out ) );
 
-        assertThat( out.toString(), isIdenticalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
-                + "<project>\n"
-                + "  <packaging>pom</packaging>\n"
+        assertThat( out.toString(), isIdenticalTo( XML_VERSION_1_0
+                + PROJECT_ELEMENT
+                + PACKAGING
                 + "  <modules>\n"
                 + "    <module>myArtifactId1</module>\n"
                 + "  </modules>\n"
-                + "</project>" ).normalizeWhitespace() );
+                + PROJECT_ELEMENT_END ) );
+    }
 
-        pom = "<project>\n"
-            + "  <modelVersion>4.0.0</modelVersion>\n"
-            + "  <packaging>pom</packaging>\n"
-            + "</project>";
+    public void testAddModuleToParentWithModelVersion()
+            throws Exception
+    {
+        String pom = PROJECT_ELEMENT
+                + MODEL_VERSION
+                + PACKAGING
+                + PROJECT_ELEMENT_END;
 
-        out = new StringWriter();
+        StringWriter out = new StringWriter();
 
 Review comment:
   Looks like this could be a field that doesn't need to be initialized in each method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-archetype] elharo commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35#discussion_r409778208
 
 

 ##########
 File path: archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
 ##########
 @@ -61,6 +61,17 @@
 public class ArchetypeTest
     extends PlexusTestCase
 {
+    private static final String XML_VERSION_1_0 =
 
 Review comment:
   splitting out these constants makes the tests harder for me to read. I prefer having all the expected content directly in each method, even at the expense of some duplication.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-archetype] newur commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml

Posted by GitBox <gi...@apache.org>.
newur commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35#discussion_r409828497
 
 

 ##########
 File path: archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
 ##########
 @@ -61,6 +61,17 @@
 public class ArchetypeTest
     extends PlexusTestCase
 {
+    private static final String XML_VERSION_1_0 =
 
 Review comment:
   Funny how different people read code. I could barley make any sense out of the initial version. Is revert in the new commit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-archetype] newur commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml

Posted by GitBox <gi...@apache.org>.
newur commented on a change in pull request #35: ARCHETYPE-584 fix indention in root pom.xml
URL: https://github.com/apache/maven-archetype/pull/35#discussion_r409828626
 
 

 ##########
 File path: archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
 ##########
 @@ -239,93 +250,118 @@ private ClassLoader getContextClassloader( Artifact archetypeArtifact, ArtifactR
         return archetypeJarLoader;
     }
 
-    public void testAddModuleToParentPOM()
-        throws Exception
+    public void testAddModuleToParentBasic()
+            throws Exception
     {
-        String pom = "<project>\n"
-            + "  <packaging>pom</packaging>\n"
-            + "</project>";
+        String pom = PROJECT_ELEMENT
+                + PACKAGING
+                + PROJECT_ELEMENT_END;
 
         StringWriter out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId1", new StringReader( pom ), out ) );
 
-        assertThat( out.toString(), isIdenticalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
-                + "<project>\n"
-                + "  <packaging>pom</packaging>\n"
+        assertThat( out.toString(), isIdenticalTo( XML_VERSION_1_0
+                + PROJECT_ELEMENT
+                + PACKAGING
                 + "  <modules>\n"
                 + "    <module>myArtifactId1</module>\n"
                 + "  </modules>\n"
-                + "</project>" ).normalizeWhitespace() );
+                + PROJECT_ELEMENT_END ) );
+    }
 
-        pom = "<project>\n"
-            + "  <modelVersion>4.0.0</modelVersion>\n"
-            + "  <packaging>pom</packaging>\n"
-            + "</project>";
+    public void testAddModuleToParentWithModelVersion()
+            throws Exception
+    {
+        String pom = PROJECT_ELEMENT
+                + MODEL_VERSION
+                + PACKAGING
+                + PROJECT_ELEMENT_END;
 
-        out = new StringWriter();
+        StringWriter out = new StringWriter();
 
 Review comment:
   Moved to setup method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services