ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: how to call a predefined target or macroin build.xml from Custom Ant task
Date Thu, 03 Sep 2009 05:09:50 GMT
<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.Raja@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-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>

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


Mime
View raw message