diff --git a/WHATSNEW b/WHATSNEW index a29d48b28..a54f66634 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -40,7 +40,9 @@ behavior has been dropped. * task syntax has been changed significantly -* build.compiler supports now jvc as well. +* is no longer implemented by org.apache.tool.ant.taskdefs.Exec. +Custom tasks that rely on Project.createTask("exec") to return an +instance of this class are going to fail. Other changes: -------------- @@ -77,6 +79,8 @@ on log output. * optional task no longer uses a separate VM to invoke the ejbc tool. +* build.compiler supports now jvc as well. + * project specific help can now be obtained with the -projecthelp option. * Added a -debug option to make -verbose less verbose (and more useful) @@ -85,6 +89,8 @@ on log output. and above (towards the root of the filesystem) if you didn't specify -buildfile and there is no build.xml in the current directory. +* can now write to a file and accepts nested text. + Fixed bugs: ----------- diff --git a/docs/index.html b/docs/index.html index d994fa9f9..afbb99dfb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,7 +12,7 @@ -

Version 1.2 - 2000/09/20

+

Version 1.2 - 2000/09/27


Table of Contents

@@ -1493,7 +1493,7 @@ subdirectories.


Echo

Description

-

Echoes a message to System.out.

+

Echoes a message to System.out or a file.

Parameters

@@ -1507,6 +1507,16 @@ subdirectories.

+ + + + + + + + + +
Yes, unless data is included in a character section within this element.
filethe file to write the message to.No
appendAppend to an existing file?No - default is false.

Examples

  <echo message="Hello world" />
diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index d6b70f974..8c480fddc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -56,7 +56,6 @@ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.*; import java.io.*; -import java.net.*; /** * Echo * @@ -64,6 +63,8 @@ import java.net.*; */ public class Echo extends Task { private String message = ""; // required + private File file = null; + private boolean append = false; /** * Does the work. @@ -71,7 +72,23 @@ public class Echo extends Task { * @exception BuildException if someting goes wrong with the build */ public void execute() throws BuildException { - System.out.println(message); + if (file == null) { + System.out.println(message); + } else { + FileWriter out = null; + try { + out = new FileWriter(file.getAbsolutePath(), append); + out.write(message, 0, message.length()); + } catch (IOException ioe) { + throw new BuildException(ioe, location); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException ioex) {} + } + } + } } /** @@ -83,10 +100,25 @@ public class Echo extends Task { this.message = msg; } + /** + * Sets the file attribute. + */ + public void setFile(File file) { + this.file = file; + } + + /** + * Shall we append to an existing file? + */ + public void setAppend(boolean append) { + this.append = append; + } + /** * Set a multiline message. */ public void addText(String msg) { - message += msg; + message += + ProjectHelper.replaceProperties(msg, project.getProperties()); } }