This section covers tasks that manipulate the content of text files.
The replace task finds and replaces a string or strings of text within a text file:
<replace file="[file]" token="[replacement value]"/>
file*: Specific file in which to replace the tokens.
dir: Directory in which to find the files whose tokens will be replaced .
token: Value of the string of text to act as an indicator for replacement.
value: Text with which to replace the token. Defaults to an empty string.
propertyFile: A file containing one name /value pair per line. This file is used by the replacefilter nested parameter tag to replace multiple strings at one time with values that can be different.
includes: Comma-separated list of patterns to use with a directory parameter.
includesfile: File in which each new line lists patterns to use with a directory parameter.
excludes: Comma-separated list of patterns not to use with a directory parameter.
excludesfile: File in which each new line lists patterns not to use with a directory parameter.
defaultexcludes: When set to yes, default excludes are to be used. Defaults to no.
token*: The value of the string of text to be replaced in the file.
value: Replacement value to be applied to the token in the file.
property: Replacement value as a property for the token to be replaced in the file:
<replace dir="${../mailTemplates}" value="foo@bla.org" includes="**/*.template" token="&mailAddress&"/>
or
<replace file="mailTemplate.txt" value="foo" propertyFile="../mailTemplates/mail.properties" > <replacefilter token="$project.name$" /> <replacefilter token="$email.link$" value="http://www.fooBuildStatus.com"/> <replacefilter token="$build.time$" property="build.time"/> </replace>
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
replacefilter: Defines tokens and replacement values.
ftoken: Value of the string of text to act as an indicator for replacement.
fvalue: Text with which to replace the token. Defaults to an empty string.
fproperty: Property that defines text with which to replace the token.
The mail task sends Simple Mail Transfer Protocol (SMTP) email:
<mail from="foo" tolist="bla" subject="Your code doesn't compile bla" files="error.log"/>
from: Email address of sender.
tolist: List of recipients separated by commas.
message: Text for the body of the email.
files: List of files to use that contain the text for the body of the email.
mailhost: Host name of the mail server.
subject: Text for the subject of the email.