Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 91142 invoked by uid 500); 5 Mar 2000 09:19:47 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Received: (qmail 91136 invoked by uid 1112); 5 Mar 2000 09:19:46 -0000 Date: 5 Mar 2000 09:19:46 -0000 Message-ID: <20000305091946.91135.qmail@locus.apache.org> From: arnout@locus.apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/docs index.html arnout 00/03/05 01:19:46 Modified: docs index.html Log: Fixed examples for writing your own task. Revision Changes Path 1.13 +13 -6 jakarta-ant/docs/index.html Index: index.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/index.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- index.html 2000/03/04 16:47:01 1.12 +++ index.html 2000/03/05 09:19:46 1.13 @@ -17,7 +17,7 @@
  • Sam Ruby (rubys@us.ibm.com)
  • -

    Version 1.0.7 - 2000/02/28

    +

    Version 1.0.8 - 2000/03/04


    Table of Contents

    @@ -2093,12 +2093,17 @@

    Let's write our own task, that prints a message on the System.out stream. The task has one attribute called "message".

    -
    public class MyVeryOwnTask extends Task {
      +  
    package com.mydomain;
      +
      +import org.apache.tools.ant.BuildException;
      +import org.apache.tools.ant.Task;
      +
      +public class MyVeryOwnTask extends Task {
         private String msg;
       
         // The method executing the task
         public void execute() throws BuildException {
      -    System.out.println(message);
      +    System.out.println(msg);
         }
       
         // The setter for the "message" attribute
      @@ -2118,13 +2123,15 @@
       
       

    Example

    -
    <project name="TaskTest" default="test" basedir=".">
      +  
    <?xml version="1.0"?>
      +
      +<project name="OwnTaskExample" default="main" basedir=".">
         <target name="init">
           <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask"/>
         </target>
       
      -  <target name="test">
      -    <mytask myattr="wombat" />
      +  <target name="main" depends="init">
      +    <mytask message="Hello World! MyVeryOwnTask works!" />
         </target>
       </project>