Filter

Description

Sets a token filter for this project or reads a properties file as multiple token filter definitions and sets them. Token filters are used by all tasks that perform file copying operations through the Project commodity methods. See the warning here before using.

The task uses @ as token separator. Token strings cannot contain separator characters; incorrect tokens are ignored.

Parameters

Attribute Description Required
token the token string without the separator chars (@) Yes; either both token and value, or only filtersfile
value the string that should be put to replace the token when the file is copied
filtersfile The file from which the filters must be read. This file must be a formatted as a property file.

Examples

Copy recursively all the files from the src.dir directory into the dest.dir directory replacing all the occurrences of the string @year@ with 2000.

<filter token="year" value="2000"/>
<copy todir="${dest.dir}" filtering="true">
  <fileset dir="${src.dir}"/>
</copy>

Read all property entries from the deploy_env.properties file and set these as filters.

<filter filtersfile="deploy_env.properties"/>