Uploaded image for project: 'Maven Resources Plugin'
  1. Maven Resources Plugin
  2. MRESOURCES-110

escapeString is broken - break filtered output

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.4.1
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven 2.0.9, WinXP

      Description

      If the escapeString parameter is specified in plugin configuration this will break the filtered output.

      For example the configuration

      <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.4.1</version>
         <configuration>
           <escapeString>!</escapeString>
         </configuration>
      </plugin>
      

      an file to filter (an XML file)

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!-- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
         <broken-tag>Content with replacement: ${replaceThis} !</broken-tag>
         <broken-tag>Content with escaped replacement: Do not !${replaceThis} !</broken-tag>
      </root>
      

      and a property

       <properties>
              <replaceThis>I am the replacement</replaceThis>
       </properties>
      

      from pom or profile.xml

      result in

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !${\}\!static.content broken if the escapeString occure ?!</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !/broken-tag>
         <broken-tag>Content with escaped replacement: Do not ${replaceThis} !/broken-tag>
      </root>
      

      Note the broken comment and tags!
      If using Resources-Plugin 2.3 the output is like expected:

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!-- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !</broken-tag>
         <broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>
      </root>
      

      Got even worse when using a complex escape string like <escapeString>static</escapeString> (I know it's a silly example ). The result is

      <?xml version=".0" encoding="UTF-8"?>
      <root>
          <!-- This is acomment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! staticcontent broken if the escapeSring occure ?!?</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !</broken-tag>
         <broken-tag>Content with escapedreplacement: Do not !I am the replacement !</broken-tag>
      </root>
      

      Note the missing characters all over the file ... :-/

      So the actual state of the escapeString feature is unpredictable and nearly useless.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olamy Olivier Lamy (*$^¨%`£)
                Reporter:
                m.rothe Marco Rothe
              • Votes:
                2 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: