Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 23564 invoked by uid 500); 14 Oct 2001 04:44:54 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 23555 invoked by uid 500); 14 Oct 2001 04:44:53 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Date: 14 Oct 2001 04:39:50 -0000 Message-ID: <20011014043950.54180.qmail@icarus.apache.org> From: stevel@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/docs/manual develop.html X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N stevel 01/10/13 21:39:50 Modified: docs/manual develop.html Log: Text + example of how to use a task in the file it is compiled. Keeping silent on taskdef's property file loading functionality so that people dont start using it just before it gets taken away. Revision Changes Path 1.4 +32 -0 jakarta-ant/docs/manual/develop.html Index: develop.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/manual/develop.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- develop.html 2001/03/09 08:54:34 1.3 +++ develop.html 2001/10/14 04:39:49 1.4 @@ -147,6 +147,7 @@
  • Use your task in the rest of the buildfile.
  • +

    Example

      @@ -161,6 +162,37 @@
       </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