FilterSets are groups of filters. Filters can be defined as token-value
pairs
or be read in from a file. FilterSets can appear inside tasks that support this
feature or at the same level as <target>
- i.e., as
children of
<project>
.
In addition, FilterSets can specify
begintoken
and/or
endtoken
attributes to define what to match.
Filtersets are used for doing
replacements in tasks such as <copy>
, etc.
Attribute | Description | Default | Required |
begintoken | The string marking the beginning of a token (eg.,
@date@ ). |
@ | No |
endtoken | The string marking the end of a token (eg.,
@date@ ). |
@ | No |
Attribute | Description | Required |
token | The token to replace (eg., @date@ ) |
Yes |
value | The value to replace it with
(eg., Thursday, April 26, 2001 ). |
Yes |
Attribute | Description | Required |
file | A properties file of name-value pairs from which to load the tokens. | Yes |
You are copying the version.txt
file to the dist
directory from the build
directory
but wish to replace the token @date@
with today's date.
<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> <filterset> <filter token="date" value="${TODAY}"/> </filterset> </copy>
You are copying the version.txt
file to the dist
directory from the build directory
but wish to replace the token %date*
with today's date.
<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> <filterset begintoken="%" endtoken="*"> <filter token="date" value="${TODAY}"/> </filterset> </copy>
Copy all the docs but change all dates and appropriate notices as stored in a file.
<copy toDir="${dist.dir}/docs" > <fileset dir="${build.dir}/docs"> <include name="**/*.html"> </fileset> <filterset begintoken="%" endtoken="*"> <filtersfile file="${user.dir}/dist.properties"/> </filterset> </copy>
Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.