[ http://jira.codehaus.org/browse/MRESOURCES-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=217651#action_217651 ]
Ian Springer edited comment on MRESOURCES-104 at 4/12/10 9:22 AM: ------------------------------------------------------------------ I think the cause of this is that when the template processor encounters the '@' character, it goes into a state where it's looking for a closing '@' character, but it should pop out of this state once it encounters a newline character (since a template variable name will never contain a newline). Once it hits a newline, it should assume the '@' was not the first character of a variable, and just print out the '@' character and the remainder of the line as-is to the target file. The read() method in the InterpolationFilterReader from plexus-utils is what is ultimately used to do the replacement of template variables (more specifically, the resources plugin calls maven filtering which calls pluex-utils FileUtils.copyFile(), which is passed a FileUtils$FilterWrapper, which wraps an InterpolationFilterReader). It is in InterpolationFilterReader.read() that code needs to be added to check for newlines. http://svn.codehaus.org/plexus/plexus-utils/trunk/src/main/java/org/codehaus/plexus/util/InterpolationFilterReader.java was (Author: ips): I think the cause of this is that when the template processor encounters the '@' character, it goes into a state where it's looking for a closing '@' character, but it should pop out of this state once it encounters a newline character (since a template variable name will never contain a newline). Once it hits a newline, it should assume the '@' was not the first character of a variable, and just print out the '@' character and the remainder of the line as-is to the target file. > while filtering resources the token replacement stops at the character @ > ------------------------------------------------------------------------- > > Key: MRESOURCES-104 > URL: http://jira.codehaus.org/browse/MRESOURCES-104 > Project: Maven 2.x Resources Plugin > Issue Type: Bug > Affects Versions: 2.4 > Environment: Windows XP, Java 1.6.0_16 > Reporter: Thomas Fahrmeyer > Fix For: 2.5 > > > Create a simple file hello.txt under src/main/resources with following > content: > " > This property ${testProperty} was replaced > but the one behind a @ will not be processed, as you > see: ${testProperty}. You shouldn't see a property reference. > " > define a build section in your pom.xml like this > <build> > <resources> > <resource> > <directory>src/main/resources</directory> > <filtering>true</filtering> > <includes> > <include>**/*.txt</include> > </includes> > </resource> > <resource> > <directory>src/main/resources</directory> > <filtering>false</filtering> > <excludes> > <exclude>**/*.txt</exclude> > </excludes> > </resource> > </resources> > Run the command: > mvn process-resources -DtestProperty=IwasReplaced > this produces the output > " > This property IwasReplaced was replaced > but the one behind a @ will not be processed, as you > see: ${testProperty}. You shouldn't see a property reference. > " > As you see, the second property reference was not resolved. The replacement > just stops after the @ character. -- 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