Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.3
-
Fix Version/s: 2.4
-
Component/s: None
-
Labels:None
-
Environment:Windows
-
Number of attachments :
Description
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 $
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
Issue Links
- depends upon
-
MSHARED-78
FilteringUtils escapeWindowsPath() doesn't work on Windows
-
- is duplicated by
-
MRESOURCES-93
Property substitution of ${project.build.directory} on Windows FAILS
-
- relates to
-
MSHARED-78
FilteringUtils escapeWindowsPath() doesn't work on Windows
-
I get the same error too, looks to be caused by
MRESOURCES-42Sometimes 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:
<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>Possible values could be NONE, JAVA (just escape the backslashes) and PROPERTY (escape colons and backslashes).
Thanks