From ffa6e24ba429847c04da9162971b6203151a7ce1 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 8 Jan 2001 16:51:34 +0000 Subject: [PATCH] Document that Task.execute() can be invoked more than once. Submitted by: Rosen, Alex git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268418 13f79535-47bb-0310-9956-ffa450edef68 --- docs/index.html | 6 +++++- src/main/org/apache/tools/ant/Task.java | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/index.html b/docs/index.html index 8dd13ffd6..c04ef17f2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6205,7 +6205,11 @@ output.
  • All attributes of all child elements get set via their corresponding setXXX methods - at runtime.
  • -
  • execute() is called at runtime.
  • +
  • execute() is called at runtime. While the above initialization + steps only occur once, the execute() method may be + called more than once, if the task is invoked more than once. For example, + if target1 and target2 both depend on target3, then running + "ant target1 target2" will run all tasks in target3 twice.
  • Example

    diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index 6ea82ac7e..563eb863e 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -168,18 +168,21 @@ public abstract class Task { } /** - * Called by the project to let the task initialize properly. Normally it does nothing. + * Called by the project to let the task initialize properly. * * @throws BuildException if someting goes wrong with the build */ public void init() throws BuildException {} /** - * Called by the project to let the task do it's work. Normally it does nothing. + * Called by the project to let the task do it's work. This method may be + * called more than once, if the task is invoked more than once. For example, + * if target1 and target2 both depend on target3, then running + * "ant target1 target2" will run all tasks in target3 twice. * * @throws BuildException if someting goes wrong with the build */ - public void execute() throws BuildException {}; + public void execute() throws BuildException {} /** * Returns the file location where this task was defined.