ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Problem regarding adding antcall task to some target via JavaScript and script task
Date Fri, 16 Oct 2009 04:27:45 GMT
On 2009-10-12, Christian Möller <> wrote:

>   <target name="init">
>     <echo>Hello from target 'init'</echo>
>     <appendExecutionOf target="extra-pre-test" toTarget="pre-test" />
>     <appendExecutionOf target="extra-post-test" toTarget="post-test" />
>   </target>

>   <target name="test" depends="init">
>     <antcall target="pre-test"/>
>     <echo>Hello from target 'test'</echo>
>     <antcall target="post-test"/>
>   </target>

> This is purposing the follwing: Adding execution of additional targets
> (here "extra-pre-test" and "extra-post-test") to some other targets
> (here "pre-test" and "post-test", respectively) depending on
> environmental properties (not shown here for simplicity).

> But unfortunalety this does not work as expected:

Your macro (which looks fine, that's why I snipped it) adds a new task
to a target in the currently executing Project instance.  In your test
you try to validate that it worked via antcall which creates a new
Project instance and re-parses the build file for that new instance -
your macro has never been executed for this instance and so the tasks
have never been added there.

If you try

<target name="test" depends="init, pre-test"/>

you should see you extra-pre-test.  Alternatively make pre-test and
post-test depend on init so the tasks get added in their Project
instance even in the presence of antcall.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message