ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francesco Marchioni" <FMnotificati...@hotmail.com>
Subject Re: 2 Questions about building my own task
Date Wed, 30 May 2001 15:49:48 GMT
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}" >
</fileset>

...into

<?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>

</project>


I thank you in advance very much
Francesco


----- Original Message -----
From: Conor MacNeill <conor@cortexebusiness.com.au>
To: <ant-user@jakarta.apache.org>
Sent: Wednesday, May 30, 2001 4:56 PM
Subject: Re: 2 Questions about building my own task


> Francesco,
>
> 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
>
> <mytask>
>    <filset>
>       <include ...>
>    </fileset>
> </mytask>
>
> 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.
>
> Conor
>
>
> ----- Original Message -----
> From: "Francesco Marchioni" <FMnotifications@hotmail.com>
> To: <ant-user@jakarta.apache.org>
> 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 Classes...so how can I pass an Enumeration of files for
> example ?
>
> Thanks a lot
> Franvcesco
>
>
>
>

Mime
View raw message