I got it.

In the <script> task, when adding new task, it has to be added to a target
that is currently running. For example,

<target name="foo">
...

foo.addTask(f);
</target>

will work when "ant foo" is called.

<target name="main" depends="foo"/>
<target name="foo">
        <script>
                ...
                foo.addTask(f);
        </script>
</target>

will also work when doing "ant main" because "main" is currently used.
However,

<target name="main" depends="foo"/>
<target name="foo">
        <script>
                ...
                bar.addTask(f);
        </script>
</target>

This won't work, because "bar" is not existed in the build sequence.

I apologize if this looks all too obvious. :-)


Rubun


-----Original Message-----
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 5:07 PM
To: Ant Users List
Subject: Re: strange behavior in script task


--- Peter Mularien <[EMAIL PROTECTED]> wrote:
> I'm looking at your script and seeing that it's adding tasks to task
> 'main'

I think you mean: target 'main'

> and not the task you're executing directly.
              ^^^^ [ditto]

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to