Name

echo

Synopsis

Writes a message to the Ant log or a file. The verbosity defaults to Project.MSG_WARN, which means that messages appear on the console.

Attributes

append (all, boolean, N)

If true, append to an existing file. Defaults to false.

file (all, File, N)

The file to write the message to.

message (all, String, *)

The text to write.

The message attribute is required unless text is included as content of the XML tag, as shown in the example that follows.

Content

Text content (all)

Text content is allowed when the message attribute is not specified. Property references such as ${builddir} are allowed.

Example Usage

The first of the following examples specifies the text to write using the message attribute. The second example specifies the text to write by enclosing it within <echo>...</echo> tags.

<echo message="Building to ${builddir}"/>
<echo>You are using version ${java.version} 
of Java! This message spans two lines.</echo>

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.