You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Jackson (JIRA)" <ji...@codehaus.org> on 2009/01/06 19:51:19 UTC

[jira] Created: (MRESOURCES-81) 2.3 escapes characters when filtering properties

2.3 escapes characters when filtering properties
------------------------------------------------

                 Key: MRESOURCES-81
                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
             Project: Maven 2.x Resources Plugin
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: Windows
            Reporter: Paul Jackson


When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:

    <profiles>
        <profile>
            <id>Automated-Testing-Windows</id>
            <properties>
                <server.resource.type>nt</server.resource.type>
                <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
                <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
            </properties>
        </profile>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources/${server.resource.type}</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <resources>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/resources</outputDirectory>
              <includeEmptyDirectories>true</includeEmptyDirectories>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

and the following line of text in a file in src\main\resources\nt
 cd /d ${server.remote.temp.dir}

Resources plug in version 2.2 filters this property as follows:
cd /d D:\\AutomatedTesting\\temp

Resources plug in version 2.3 filters this property differently:
cd /d D\:\\\\AutomatedTesting\\\\temp

Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
 
I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.

Thanks,
-Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (MRESOURCES-81) 2.3 escapes characters when filtering properties

Posted by "Jason Royals (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160191#action_160191 ] 

Jason Royals edited comment on MRESOURCES-81 at 1/6/09 10:39 PM:
-----------------------------------------------------------------

I get the same error too, looks to be caused by MRESOURCES-42

Sometimes escaping the backslash is needed, and sometimes it is not, depending on what is being filtered.  In my situation I need to specify ${builddir} in an XML file which is filtered.  Now I get backslashes in the XML file where they were not before, and the build breaks because the library  that uses that XML file is not expecting all that extra escaping.

I wonder if there could be an optional element under the {{<resource>}} and {{<testResource>}} section of the pom to be able to control at a resources level how characters are escaped.  For example:

{code}
<resource>
    <directory>src/main/webapp/WEB-INF</directory>
    <filtering>true</filtering>
    <escape>NONE</escape>
    <includes>
        <include>**/*.xml</include>
    </includes>
    <targetPath>../POSPolicyService-FunctionalTest/WEB-INF</targetPath>
</resource>
{code}

Possible values could be NONE, JAVA (just escape the backslashes) and PROPERTY (escape colons and backslashes).

Thanks


      was (Author: majikshoe):
    I get the same error too, looks to be caused by MRESOURCES-42

Sometimes escaping the backslash is needed, and sometimes it is not, depending on what is being filtered.  In my situation I need to specify ${builddir} in an XML file which is filtered.  Now I get backslashes in the XML file where they were not before, and the build breaks because the library  that uses that XML file is not expecting all that extra escaping.

I wonder if there could be an optional element under the {{<resource>}} and {{<testResource>}}section of the pom to be able to control at a resources level how characters are escaped.  For example:

{code}
<resource>
    <directory>src/main/webapp/WEB-INF</directory>
    <filtering>true</filtering>
    <escape>NONE</escape>
    <includes>
        <include>**/*.xml</include>
    </includes>
    <targetPath>../POSPolicyService-FunctionalTest/WEB-INF</targetPath>
</resource>
{code}

Possible values could be NONE, JAVA (just escape the backslashes) and PROPERTY (escape colons and backslashes).

Thanks

  
> 2.3 escapes characters when filtering properties
> ------------------------------------------------
>
>                 Key: MRESOURCES-81
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows
>            Reporter: Paul Jackson
>
> When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:
>     <profiles>
>         <profile>
>             <id>Automated-Testing-Windows</id>
>             <properties>
>                 <server.resource.type>nt</server.resource.type>
>                 <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
>                 <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
>             </properties>
>         </profile>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources/${server.resource.type}</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>     <resources>
>     <plugins>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <version>2.3</version>
>         <executions>
>           <execution>
>             <id>resources</id>
>             <phase>process-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>             <configuration>
>               <outputDirectory>${project.build.directory}/resources</outputDirectory>
>               <includeEmptyDirectories>true</includeEmptyDirectories>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> and the following line of text in a file in src\main\resources\nt
>  cd /d ${server.remote.temp.dir}
> Resources plug in version 2.2 filters this property as follows:
> cd /d D:\\AutomatedTesting\\temp
> Resources plug in version 2.3 filters this property differently:
> cd /d D\:\\\\AutomatedTesting\\\\temp
> Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
>  
> I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.
> Thanks,
> -Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-81) 2.3 escapes characters when filtering properties

Posted by "Jason Royals (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160191#action_160191 ] 

Jason Royals commented on MRESOURCES-81:
----------------------------------------

I get the same error too, looks to be caused by MRESOURCES-42

Sometimes escaping the backslash is needed, and sometimes it is not, depending on what is being filtered.  In my situation I need to specify ${builddir} in an XML file which is filtered.  Now I get backslashes in the XML file where they were not before, and the build breaks because the library  that uses that XML file is not expecting all that extra escaping.

I wonder if there could be an optional element under the {{<resource>}} and {{<testResource>}}section of the pom to be able to control at a resources level how characters are escaped.  For example:

{code}
<resource>
    <directory>src/main/webapp/WEB-INF</directory>
    <filtering>true</filtering>
    <escape>NONE</escape>
    <includes>
        <include>**/*.xml</include>
    </includes>
    <targetPath>../POSPolicyService-FunctionalTest/WEB-INF</targetPath>
</resource>
{code}

Possible values could be NONE, JAVA (just escape the backslashes) and PROPERTY (escape colons and backslashes).

Thanks


> 2.3 escapes characters when filtering properties
> ------------------------------------------------
>
>                 Key: MRESOURCES-81
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows
>            Reporter: Paul Jackson
>
> When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:
>     <profiles>
>         <profile>
>             <id>Automated-Testing-Windows</id>
>             <properties>
>                 <server.resource.type>nt</server.resource.type>
>                 <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
>                 <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
>             </properties>
>         </profile>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources/${server.resource.type}</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>     <resources>
>     <plugins>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <version>2.3</version>
>         <executions>
>           <execution>
>             <id>resources</id>
>             <phase>process-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>             <configuration>
>               <outputDirectory>${project.build.directory}/resources</outputDirectory>
>               <includeEmptyDirectories>true</includeEmptyDirectories>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> and the following line of text in a file in src\main\resources\nt
>  cd /d ${server.remote.temp.dir}
> Resources plug in version 2.2 filters this property as follows:
> cd /d D:\\AutomatedTesting\\temp
> Resources plug in version 2.3 filters this property differently:
> cd /d D\:\\\\AutomatedTesting\\\\temp
> Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
>  
> I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.
> Thanks,
> -Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-81) 2.3 escapes characters when filtering properties

Posted by "Anders Olsson (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=204405#action_204405 ] 

Anders Olsson commented on MRESOURCES-81:
-----------------------------------------

I agree with Jason above and escapeWindowsPaths seems like a very backward solution to me.

Introducing this change does fix the special case that window paths happen to contain characters that need to be escaped in a certain way if they are later to be interpreted in a certain way. But this breaks existing projects using window paths, which happened to me using xml files.

A cleaner, more complete and backwards compatible fix would be to add optional escaping and providing common schemes as Jason suggests.

> 2.3 escapes characters when filtering properties
> ------------------------------------------------
>
>                 Key: MRESOURCES-81
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows
>            Reporter: Paul Jackson
>            Assignee: John Casey
>             Fix For: 2.4
>
>
> When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:
>     <profiles>
>         <profile>
>             <id>Automated-Testing-Windows</id>
>             <properties>
>                 <server.resource.type>nt</server.resource.type>
>                 <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
>                 <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
>             </properties>
>         </profile>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources/${server.resource.type}</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>     <resources>
>     <plugins>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <version>2.3</version>
>         <executions>
>           <execution>
>             <id>resources</id>
>             <phase>process-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>             <configuration>
>               <outputDirectory>${project.build.directory}/resources</outputDirectory>
>               <includeEmptyDirectories>true</includeEmptyDirectories>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> and the following line of text in a file in src\main\resources\nt
>  cd /d ${server.remote.temp.dir}
> Resources plug in version 2.2 filters this property as follows:
> cd /d D:\\AutomatedTesting\\temp
> Resources plug in version 2.3 filters this property differently:
> cd /d D\:\\\\AutomatedTesting\\\\temp
> Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
>  
> I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.
> Thanks,
> -Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MRESOURCES-81) 2.3 escapes characters when filtering properties

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MRESOURCES-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey closed MRESOURCES-81.
--------------------------------

    Resolution: Fixed

new parameter has been introduced: escapeWindowsPaths. This is true by default to preserve backward compat, but can be turned off to disable path escaping.

> 2.3 escapes characters when filtering properties
> ------------------------------------------------
>
>                 Key: MRESOURCES-81
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows
>            Reporter: Paul Jackson
>            Assignee: John Casey
>             Fix For: 2.4
>
>
> When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:
>     <profiles>
>         <profile>
>             <id>Automated-Testing-Windows</id>
>             <properties>
>                 <server.resource.type>nt</server.resource.type>
>                 <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
>                 <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
>             </properties>
>         </profile>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources/${server.resource.type}</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>     <resources>
>     <plugins>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <version>2.3</version>
>         <executions>
>           <execution>
>             <id>resources</id>
>             <phase>process-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>             <configuration>
>               <outputDirectory>${project.build.directory}/resources</outputDirectory>
>               <includeEmptyDirectories>true</includeEmptyDirectories>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> and the following line of text in a file in src\main\resources\nt
>  cd /d ${server.remote.temp.dir}
> Resources plug in version 2.2 filters this property as follows:
> cd /d D:\\AutomatedTesting\\temp
> Resources plug in version 2.3 filters this property differently:
> cd /d D\:\\\\AutomatedTesting\\\\temp
> Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
>  
> I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.
> Thanks,
> -Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MRESOURCES-81) 2.3 escapes characters when filtering properties

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MRESOURCES-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MRESOURCES-81:
--------------------------------------

    Description: 
When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:

{code:xml}
    <profiles>
        <profile>
            <id>Automated-Testing-Windows</id>
            <properties>
                <server.resource.type>nt</server.resource.type>
                <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
                <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
            </properties>
        </profile>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources/${server.resource.type}</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <resources>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/resources</outputDirectory>
              <includeEmptyDirectories>true</includeEmptyDirectories>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
{code}

and the following line of text in a file in src\main\resources\nt
 cd /d ${server.remote.temp.dir}

Resources plug in version 2.2 filters this property as follows:
cd /d D:\\AutomatedTesting\\temp

Resources plug in version 2.3 filters this property differently:
cd /d D\:\\\\AutomatedTesting\\\\temp

Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
 
I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.

Thanks,
-Paul

  was:
When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:

    <profiles>
        <profile>
            <id>Automated-Testing-Windows</id>
            <properties>
                <server.resource.type>nt</server.resource.type>
                <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
                <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
            </properties>
        </profile>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources/${server.resource.type}</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <resources>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/resources</outputDirectory>
              <includeEmptyDirectories>true</includeEmptyDirectories>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

and the following line of text in a file in src\main\resources\nt
 cd /d ${server.remote.temp.dir}

Resources plug in version 2.2 filters this property as follows:
cd /d D:\\AutomatedTesting\\temp

Resources plug in version 2.3 filters this property differently:
cd /d D\:\\\\AutomatedTesting\\\\temp

Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
 
I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.

Thanks,
-Paul


> 2.3 escapes characters when filtering properties
> ------------------------------------------------
>
>                 Key: MRESOURCES-81
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-81
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows
>            Reporter: Paul Jackson
>            Assignee: John Casey
>             Fix For: 2.4
>
>
> When filtering a property additional escaping characters are inserted into the replacement text.  Here's an example pom snippett:
> {code:xml}
>     <profiles>
>         <profile>
>             <id>Automated-Testing-Windows</id>
>             <properties>
>                 <server.resource.type>nt</server.resource.type>
>                 <server.remote.base.dir>D:\\AutomatedTesting</server.remote.base.dir>
>                 <server.remote.temp.dir>${server.remote.base.dir}\\temp</server.remote.temp.dir>
>             </properties>
>         </profile>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources/${server.resource.type}</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>     <resources>
>     <plugins>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <version>2.3</version>
>         <executions>
>           <execution>
>             <id>resources</id>
>             <phase>process-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>             <configuration>
>               <outputDirectory>${project.build.directory}/resources</outputDirectory>
>               <includeEmptyDirectories>true</includeEmptyDirectories>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> {code}
> and the following line of text in a file in src\main\resources\nt
>  cd /d ${server.remote.temp.dir}
> Resources plug in version 2.2 filters this property as follows:
> cd /d D:\\AutomatedTesting\\temp
> Resources plug in version 2.3 filters this property differently:
> cd /d D\:\\\\AutomatedTesting\\\\temp
> Notice the extra backslashes inserted before each backslash (minor issue) and colon (major issue).  Is there a way to prevent maven from inserting these escape characters?
>  
> I also checked out 2.4-SNAPSHOT revision 732027 and observed the same behavior.
> Thanks,
> -Paul

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira