Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: escape string
    • Labels:
      None
    • Environment:
      maven 2.2.1

      Description

      if I configure the maven-resource-plugin in order to escape a delimiter in a comment, the escapeString is not removed in the target.

      src/main/resources/properties/test.properties
      #%comment to espace:§@toto
      question=@message@
      
      pom.xml
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.5-SNAPSHOT</version>
         <configuration>
           <escapeString>§</escapeString>
         </configuration>  
       </plugin>
      
      target/classes/properties/test.properties
      #%comment to espace:§@toto
      question=A nice message...
      
      1. maven-resources-plugin-EscapeString.zip
        1 kB
        Sanlaville Rémy
      2. MRESOURCES-134.zip
        2 kB
        dennislundberg

        Activity

        Hide
        Sanlaville Rémy added a comment -

        I also try with #%comment to espace:§@toto@ and I have the same problem.

        Show
        Sanlaville Rémy added a comment - I also try with #%comment to espace:§@toto@ and I have the same problem.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        IMHO this must be WON'T FIX
        see http://maven.apache.org/plugins/maven-resources-plugin/examples/escape-filtering.html
        escapeString is here to prevent escaping.
        So in your line : #%comment to espace:§@toto
        I don't see any filtering because the end token is missing.
        Désolé

        Show
        Olivier Lamy (*$^¨%`£) added a comment - IMHO this must be WON'T FIX see http://maven.apache.org/plugins/maven-resources-plugin/examples/escape-filtering.html escapeString is here to prevent escaping. So in your line : #%comment to espace:§@toto I don't see any filtering because the end token is missing. Désolé
        Hide
        Dennis Lundberg added a comment -

        I agree with Olivier. This is working as it should. No change is needed.

        By the way, your sample project has an invalid character as the escapeString. It just shows up as a question mark icon in my Java based IDE. That could explain why you are having problems.

        Show
        Dennis Lundberg added a comment - I agree with Olivier. This is working as it should. No change is needed. By the way, your sample project has an invalid character as the escapeString. It just shows up as a question mark icon in my Java based IDE. That could explain why you are having problems.
        Hide
        Sanlaville Rémy added a comment -

        As I said, I also try with #%comment to espace:§@toto@ and I have the same problem.
        I don't think it is working as it should.
        Isn't it the same to RESOURCES-110

        Also, how to deal with this case?

        question=@message@
        mailbox =contact@toto.com
        

        where I want to escape the @ of contact@toto.com

        Dennis, In fact I wasn't in UTF-8 encoding but it does not change anything.

        Show
        Sanlaville Rémy added a comment - As I said, I also try with #%comment to espace:§@toto@ and I have the same problem. I don't think it is working as it should. Isn't it the same to RESOURCES-110 Also, how to deal with this case? question=@message@ mailbox =contact@toto.com where I want to escape the @ of contact@toto.com Dennis, In fact I wasn't in UTF-8 encoding but it does not change anything.
        Hide
        Sanlaville Rémy added a comment -

        With the last 2.5-SNAPSHOT it's now working. I do not have to define an escapeString in my property file

        src/main/resources/properties/test.properties
        #%comment:@toto
        question=@message@
        mailbox =contact@toto.com
        other.question=@validation@
        
        target/classes/properties/test.properties
        #%comment: @toto
        question=A nice message...
        mailbox =contact@toto.com
        other.question=A validation message ?
        

        But, strangely, I have to configure the maven resource plugin with escapeString otherwise it does not work.

        Also, #%comment to espace:§@toto does not work but it don't need it now.

        Show
        Sanlaville Rémy added a comment - With the last 2.5-SNAPSHOT it's now working. I do not have to define an escapeString in my property file src/main/resources/properties/test.properties #%comment:@toto question=@message@ mailbox =contact@toto.com other.question=@validation@ target/classes/properties/test.properties #%comment: @toto question=A nice message... mailbox =contact@toto.com other.question=A validation message ? But, strangely, I have to configure the maven resource plugin with escapeString otherwise it does not work. Also, #%comment to espace:§@toto does not work but it don't need it now.
        Hide
        Dennis Lundberg added a comment -

        Your example

        question=@message@
        mailbox =contact@toto.com
        

        works out of the box in 2.5-SNAPSHOT. You don't have to add any escapeString for it to work.

        The escapeString parameter has no default value, which is why you have to configure it.

        Show
        Dennis Lundberg added a comment - Your example question=@message@ mailbox =contact@toto.com works out of the box in 2.5-SNAPSHOT. You don't have to add any escapeString for it to work. The escapeString parameter has no default value, which is why you have to configure it.
        Hide
        Sanlaville Rémy added a comment -

        The escapeString parameter seems to have default value

        Expression preceded with the String won't be interpolated \${foo} 
        will be replaced with ${foo}.
        Default value is: ${maven.resources.escapeString}.
        

        Also I don't understand why I have to configure the plugin if I don't need any escapeString. If I remove this configuration, it does not work...

        pom.xml
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
           <version>2.5-SNAPSHOT</version>
           <configuration>
             <escapeString>§</escapeString>
           </configuration>  
         </plugin>
        
        Show
        Sanlaville Rémy added a comment - The escapeString parameter seems to have default value Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}. Default value is: ${maven.resources.escapeString}. Also I don't understand why I have to configure the plugin if I don't need any escapeString. If I remove this configuration, it does not work... pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.5-SNAPSHOT</version> <configuration> <escapeString>§</escapeString> </configuration> </plugin>
        Hide
        Dennis Lundberg added a comment -

        The escapeString does not have a default value. The text you are referring to is the "expression" for the parameter. This is a way to configure a value for through the command line. It would look like this:

        mvn process-resources -Dmaven.resources.escapeString=§
        

        By the way, where did you find that text? We should try to improve the documentation.

        If you do not configure the escapeString no escaping should be done. So your example should work. Can you assemble a zip-file with the files you are using so that we can verify this?

        Show
        Dennis Lundberg added a comment - The escapeString does not have a default value. The text you are referring to is the "expression" for the parameter. This is a way to configure a value for through the command line. It would look like this: mvn process-resources -Dmaven.resources.escapeString=§ By the way, where did you find that text? We should try to improve the documentation. If you do not configure the escapeString no escaping should be done. So your example should work. Can you assemble a zip-file with the files you are using so that we can verify this?
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        documentation fixed in rev 1059420

        Show
        Olivier Lamy (*$^¨%`£) added a comment - documentation fixed in rev 1059420
        Hide
        Sanlaville Rémy added a comment -

        @Dennis: The text was taken from the documentation (http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html). Thanks @Olivier for the fixed.

        You can try with the attached example maven-resources-plugin-EscapeString.zip
        If I remove the resource plugin configuration, I have this result (even with the last 2.5-SNAPSHOT version)

        target/classes/properties/test.properties
        #%comment: @toto
        question=@message@
        mailbox =contact@toto.com
        
        #%comment
        other.question=A validation message ?
        
        Show
        Sanlaville Rémy added a comment - @Dennis: The text was taken from the documentation ( http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html ). Thanks @Olivier for the fixed. You can try with the attached example maven-resources-plugin-EscapeString.zip If I remove the resource plugin configuration, I have this result (even with the last 2.5-SNAPSHOT version) target/classes/properties/test.properties #%comment: @toto question=@message@ mailbox =contact@toto.com #%comment other.question=A validation message ?
        Hide
        Dennis Lundberg added a comment -

        Rémy,

        Here's a sample project that looks like the one you are describing. This is working nicely for me. Can you please try it and see if it works for you?

        Show
        Dennis Lundberg added a comment - Rémy, Here's a sample project that looks like the one you are describing. This is working nicely for me. Can you please try it and see if it works for you?
        Hide
        Sanlaville Rémy added a comment -

        Dennis,

        It works well for both your sample project and mine too (today).
        I don't know why yesterday mine didn't worked.

        Anyway, I'm glad that it's working as expected.
        Thanks.

        Show
        Sanlaville Rémy added a comment - Dennis, It works well for both your sample project and mine too (today). I don't know why yesterday mine didn't worked. Anyway, I'm glad that it's working as expected. Thanks.
        Hide
        Dennis Lundberg added a comment -

        Thanks for helping us verify that it is fixed.

        Show
        Dennis Lundberg added a comment - Thanks for helping us verify that it is fixed.

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Sanlaville Rémy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development