You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Daniel Beland (JIRA)" <ji...@codehaus.org> on 2008/10/13 13:10:51 UTC

[jira] Commented: (MRESOURCES-29) An escape mechanism for property interpolation is missing.

    [ http://jira.codehaus.org/browse/MRESOURCES-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=150657#action_150657 ] 

Daniel Beland commented on MRESOURCES-29:
-----------------------------------------

None of the suggested workarounds worked for me and I don't want to use the 2.3-SNAPSHOT.
So until it is released here is how we can achieve it, works for me:

Use $${property} when you want to escape a property and simply process the resources with ant after the filtering is done

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>escape-properties</id>
            <phase>process-resources</phase>
            <configuration>
              <tasks>
                <replace dir="${project.build.directory}/classes" includes="**/*.properties,**/*.xml,**/*.vm">
                  <replacetoken><![CDATA[$$]]></replacetoken>
                  <replacevalue><![CDATA[$]]></replacevalue>
                </replace>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.7.1</version>
          </dependency>
        </dependencies>
      </plugin>


> An escape mechanism for property interpolation is missing.
> ----------------------------------------------------------
>
>                 Key: MRESOURCES-29
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-29
>             Project: Maven 2.x Resources Plugin
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Hendrik Schreiber
>            Assignee: Olivier Lamy
>             Fix For: 2.3
>
>
> It would be great, if there was a mechanism that let's you escape a property so that it is not replaced by the filtering machism. E.g. in a log4j.xml configuration file you might want to preserve ${user.home}, but replace some other property like ${log.dir}. Currently there is no convenient way to achieve that.
> Alternatively to escaping, it would be helpful, if one could choose the token format. So, if one could say, only honor @token@ and not ${token} (or the other way around) one could easily work around the escape problem.
> Workaround for the problem mentioned above:
> replace the ${user.home} in log4j.xml with @start@user.home@end@ and define     start=${    and end=$}   in the property file

-- 
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