<project>

<macrodef name="echo1">
    <attribute name="foo" default="default"/>
    <sequential>
        <echo message="@{foo}"/>
    </sequential>
</macrodef>
<script language="javascript">
<![CDATA[
    // Create the macro like a normal task
    task = project.createTask("echo1");
    // and execute it
    task.execute();
    
    // setting attributes like normal tasks doesnt work because there is no 
setter
    // implemented.
    //    task.setFoo("my text");
    // so the macro uses a dynamic way defined in 
org.apache.tools.ant.DynamicAttribute here
    task.setDynamicAttribute("foo", "my text");
    task.execute();
]]>
</script>

</project>



Jan 

>-----Ursprüngliche Nachricht-----
>Von: Raja Nagendra Kumar [mailto:nagendra.r...@tejasoft.com] 
>Gesendet: Mittwoch, 2. September 2009 20:25
>An: dev@ant.apache.org
>Betreff: Re: how to call a predefined target or macroin 
>build.xml from Custom Ant task
>
>
>Hi,
>
>I see there is a way to execut target using 
>getProject().executeTarget()..
>but don't find a way to execute the macro. Any pointers pl.
>
>Regards,
>Nagendra
>
>
>
>-- 
>View this message in context: 
>http://www.nabble.com/how-to-call-a-predefined-target-or-macroi
>n-build.xml-from-Custom-Ant-task-tp25260761p25263010.html
>Sent from the Ant - Dev mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
>For additional commands, e-mail: dev-h...@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to