Skip to content

Instantly share code, notes, and snippets.

@6footplus
Created January 14, 2010 10:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 6footplus/277027 to your computer and use it in GitHub Desktop.
Save 6footplus/277027 to your computer and use it in GitHub Desktop.
ANT's default filtering placeholders are in the form :
@token@
where beginToken="@" and endToken="@" (see http://ant.apache.org/manual/CoreTypes/filterset.html)
As with maven, property files may have tokens in the form
${some.property}
Sadly the following:
<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt">
<filterset begintoken="${" endtoken="}">
<filter token="DATE" value="${TODAY}"/>
</filterset>
</copy>
will fail : "Syntax error in property: ${"
Solution:
<property name="dollar" value="$"/>
<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt">
<filterset begintoken="${dollar}{" endtoken="}">
<filter token="DATE" value="${TODAY}"/>
</filterset>
</copy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment