diff --git a/docs/manual/credits.html b/docs/manual/credits.html index 28ad12f34..7c48a6356 100644 --- a/docs/manual/credits.html +++ b/docs/manual/credits.html @@ -2,7 +2,7 @@ -Apache Ant User Manual +Apache Ant User Manual - Credits diff --git a/docs/manual/develop.html b/docs/manual/develop.html index 673a249ac..e9c66af87 100644 --- a/docs/manual/develop.html +++ b/docs/manual/develop.html @@ -2,7 +2,7 @@ -Apache Ant User Manual +Writing Your Own Task @@ -12,7 +12,7 @@

It is very easy to write your own task:

  1. Create a Java class that extends org.apache.tools.ant.Task.
  2. -
  3. For each attribute, write a setter method. The setter method must be a +
  4. For each attribute, write a setter method. The setter method must be a public void method that takes a single argument. The name of the method must begin with set, followed by the attribute name, with the first character of the name in uppercase, and the rest in @@ -26,7 +26,7 @@ any primitive type (they are converted for you from their String-representation in the buildfile)
  5. -boolean - your method will be passed the value +boolean - your method will be passed the value true if the value specified in the buildfile is one of true, yes, or on)
  6. @@ -35,11 +35,11 @@ boolean - your method will be passed the value
  7. File -(in which case the value of the attribute is interpreted relative to the +(in which case the value of the attribute is interpreted relative to the project's basedir)
  8. -any other type that has a constructor with a single +any other type that has a constructor with a single String argument
  9. @@ -50,16 +50,16 @@ as an argument to your setter method. See org/apache/tools/ant/taskdefs/FixCRLF.java for an example. -
  10. If the task should support character data, write a public void +
  11. If the task should support character data, write a public void addText(String) method.
  12. For each nested element, write a create or add method. -A create method -must be a public method that takes no arguments and returns -an Object type. The name of the create method must begin with -create, followed by the element name. An add method must be -a public void method that takes a single argument of an +A create method +must be a public method that takes no arguments and returns +an Object type. The name of the create method must begin with +create, followed by the element name. An add method must be +a public void method that takes a single argument of an Object type with a no-argument constructor. -The name of the add method +The name of the add method must begin with add, followed by the element name.
  13. Write a public void execute method, with no arguments, that throws a BuildException. This method implements the task @@ -101,11 +101,11 @@ itself.
  14. All attributes of all child elements get set via their corresponding setXXX methods, at runtime.
  15. -
  16. 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, +
  17. 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 + on target3, then running 'ant target1 target2' will run all tasks in target3 twice.
@@ -163,8 +163,8 @@ public class MyVeryOwnTask extends Task {

Example 2

-To use a task directly from the buildfile which created it, place the -<taskdef> declaration inside a target +To use a task directly from the buildfile which created it, place the +<taskdef> declaration inside a target after the compilation. Use the classpath attribute of <taskdef> to point to where the code has just been compiled. @@ -178,9 +178,9 @@ compiled. <mkdir dir="build"/> <javac srcdir="source" destdir="build"/> </target> - + <target name="declare" depends="build"> - <taskdef name="mytask" + <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask" classpath="build"/> </target> @@ -200,13 +200,13 @@ package. Then you can use it as if it were a built-in task.


Build Events

-

Ant is capable of generating build events as it performs the tasks necessary to build a project. +

Ant is capable of generating build events as it performs the tasks necessary to build a project. Listeners can be attached to Ant to receive these events. This capability could be used, for example, -to connect Ant to a GUI or to integrate Ant with an IDE. +to connect Ant to a GUI or to integrate Ant with an IDE.

-

To use build events you need to create an ant Project object. You can then call the +

To use build events you need to create an ant Project object. You can then call the addBuildListener method to add your listener to the project. Your listener must implement -the org.apache.tools.antBuildListener interface. The listener will receive BuildEvents +the org.apache.tools.antBuildListener interface. The listener will receive BuildEvents for the following events