Ant FilterSet

来源:互联网 发布:查看端口是否打开 编辑:程序博客网 时间:2024/06/06 08:31

FilterSet是一组Filter的集合,那什么是Filter,这个词英文的意思是过滤。Filtersets are used for doing replacements in tasks such as <copy>, etc.

AttributeDescriptionDefaultRequiredbegintokenThe string marking the beginning of a token (eg., @DATE@).@NoendtokenThe string marking the end of a token (eg., @DATE@).@NofiltersfileSpecify a single filtersfile.noneNorecurseIndicates whether the replacement text of tokens should be searched for more tokens. Since Ant 1.6.3trueNoonmissingfiltersfileIndicate behavior when a nonexistent filtersfile is specified. One of "fail", "warn", "ignore". Since Ant 1.7"fail"No

Filter

AttributeDescriptionRequiredtokenThe token to replace (eg., @DATE@)YesvalueThe value to replace it with (eg., Thursday, April 26, 2001).Yes

Filtersfile

AttributeDescriptionRequiredfileA properties file of name-value pairs from which to load the tokens.Yes

 

看个例子:

<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt">

<filterset begintoken="%" endtoken="*">

<filter token="DATE" value="${TODAY}"/>

</filterset>

</copy>

copying the version.txt
file to the dist
directory from the build directory but wish to replace the token %DATE*
with today's date.





原创粉丝点击