ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bucanek <>
Subject Re: 2 Questions about building my own task
Date Wed, 30 May 2001 16:11:24 GMT
At 5:49 PM +0200 5/30/01, Francesco Marchioni wrote:
>Hi Conor,
>thank you very much for your advice.
>As you suggest I have inserted a method  "void addFileset(FileSet set)"
>in my own task. It compiles correctly.
>Unfortunately I haven't been able to insert a fileset definition
>into my task "area". I get various parsing errors...please could you tell me
>where to
>insert a basic
><fileset dir="${client.src}" >
><?xml version="1.0"?>
><project name="OwnTaskExample" default="main" basedir=".">
>   <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask"/>
>   <target name="main">
>     <mytask message="Hello World! MyVeryOwnTask works!"/>
>   </target>


Since your task's tag is using a message="Hello..." attribute, I 
assume you also have a corresponding setter method:

     class MyVeryOwnTask extend Task

         public void setMessage( String message )

Also, in your previous example you said you defined a

     void addFileset( FileSet set )

Remember that all of these methods are accessed via reflection, and 
must be public or they won't be accessible to ant:

     public void addFileset( FileSet set )

Hope that helps,


James Bucanek

View raw message