Try
task.setOwningTarget( self.getOwningTarget() );
'self' is referencing the task and the new created instance will get
its owning target.
Jan
> -Ursprüngliche Nachricht-
> Von: Al Le [mailto:al...@gmx.de]
> Gesendet: Dienstag, 26. April 2016 08:53
> An: user@ant.apache.org
> Betreff: How to create a task associated a target
>
> Hello,
>
> in my ant script, I do the following:
>
> 1. there is a target "calledTarget"
>
> 2. there is a task "macroTask", defined via "macrodef". This task
> contains in its body a call to "calledTarget" (via "antcall").
>
> 3. there is a target "mainTarget" which contains a task "script"
> (javascript). In this script, I create an instance of macroTask and
> then execute it.
>
>
> Here's the picture as an outline:
>
>
>
>
>