ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject Re: 2 Questions about building my own task
Date Wed, 30 May 2001 14:56:45 GMT

I believe it is better to extend Task rather than MatchingTask.
MatchingTask is an old approach to supporting filesets. The new approach is
to provide a method
    void addFileset(FileSet set)
which adds a fileset to an array of filesets that your will task will
subsequently process.

To be able to pass a Class argument to a task (through an addXXX method),
the Class must meet some requirements. It must support a zero argument
constructor and it must provide setXXX methods to allow the attributes of
the argument to be set. Fileset meets these conditions so with the above
definition, you can have

      <include ...>

Where the class you wish to use does not have a zero argument constructor,
you can use an alternative form

    FileSet createFileset()

Here you are responsible for creating the object and then Ant will
configure it using setXXX methods.

An Enumeration is not suitable to use in either case. Use a fileset and
then ask it for the files you should process.


----- Original Message -----
From: "Francesco Marchioni" <>
To: <>
Sent: Thursday, May 31, 2001 12:18 AM
Subject: 2 Questions about building my own task

Hi all,
I'd be very grateful if somebody exaplains me the difference between
task that extends "Task" and those that extends "Matching Task" - what else
can I do with a "Matching Task" ?
And one more question (sorry for posting it again - but I got no answer
'til now):
How can I pass arguments to my Task different from Strings ? Docs say
I can pass also how can I pass an Enumeration of files for
example ?

Thanks a lot

View raw message