You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by T Master <tm...@iknowledgeinc.com> on 2001/08/07 22:11:20 UTC

developing custom task - DirectoryScanner help needed

The saga continues...

I have made my task to support usage of javancss.  I do NOT extend from
MatchedTask.

However, I am having problems using DirectoryScanner.  I am trying to obtain
this from a fileset, as per code snippet from task delete.  The method call
to obtain the DirectoryScanner requires a Project.  Where should this be
instantiated or referenced from?

Line 2 is in question.  Code snippet:
            FileSet fs = (FileSet) filesets.elementAt(i);
            DirectoryScanner ds = new DirectoryScanner(); //
fs.getDirectoryScanner(project);
            String[] files = ds.getIncludedFiles();

If a new Project object were created, it would not know anything about my
fileset attributes.  So I'm lost now.

Tariq



Re: developing custom task - DirectoryScanner help needed

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 8 Aug 2001, T. Master <tm...@iknowledgeinc.com> wrote:

> Now i need to edit the properties file.

Don't do that!  This way you'd have to rejar Ant everytime you want to
upgrade it.

> Would you recommend declaring a custom task in a default.properties
> file, or using a taskdef in a team environment?

<taskdef>

Stefan

Re: developing custom task - DirectoryScanner help needed

Posted by T Master <tm...@iknowledgeinc.com>.
Thank you Stefan.  That compiled.
Now i need to edit the properties file.
Would you recommend declaring a custom task in a default.properties file, or
using a taskdef in a team environment?

The former requires all team members to check out the properties file in a
new ant.jar file, whereas the latter doesn't.
Is it possible to have a default.properties file in another directory or
${basedir} ?

T Master

----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Tuesday, August 07, 2001 11:45 PM
Subject: Re: developing custom task - DirectoryScanner help needed


> On Tue, 7 Aug 2001, T. Master <tm...@iknowledgeinc.com> wrote:
>
> > The method call to obtain the DirectoryScanner requires a Project.
> > Where should this be instantiated or referenced from?
>
> If your task extends Task, you'll have access to the current project
> instance via the protected project member - this happens as step 2 in
> the "The Life-cycle of a Task" section of the "Developing with Ant"
> page in Ant's manual.
>
> Stefan
>


Re: developing custom task - DirectoryScanner help needed

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 7 Aug 2001, T. Master <tm...@iknowledgeinc.com> wrote:

> The method call to obtain the DirectoryScanner requires a Project.
> Where should this be instantiated or referenced from?

If your task extends Task, you'll have access to the current project
instance via the protected project member - this happens as step 2 in
the "The Life-cycle of a Task" section of the "Developing with Ant"
page in Ant's manual.

Stefan