diff --git a/docs/manual/develop.html b/docs/manual/develop.html index 8b6d327dd..c9c28622b 100644 --- a/docs/manual/develop.html +++ b/docs/manual/develop.html @@ -147,6 +147,7 @@ public class MyVeryOwnTask extends Task {
  • Use your task in the rest of the buildfile.
  • +

    Example

    @@ -161,6 +162,37 @@ public class MyVeryOwnTask extends Task {
     </project>
     
    +

    Example 2

    +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. +
    +
    +<?xml version="1.0"?>
    +
    +<project name="OwnTaskExample2" default="main" basedir=".">
    +
    +  <target name="build" >
    +    <mkdir dir="build"/>
    +    <javac srcdir="source" destdir="build"/>
    +  </target>
    +  
    +  <target name="declare" depends="build">
    +    <taskdef name="mytask" 
    +        classname="com.mydomain.MyVeryOwnTask"
    +        classpath="build"/>
    +  </target>
    +
    +  <target name="main" depends="declare">
    +    <mytask message="Hello World! MyVeryOwnTask works!"/>
    +  </target>
    +</project>
    +
    +
    + +

    Another way to add a task (more permanently), is to add the task name and implementing class name to the default.properties file in the org.apache.tools.ant.taskdefs