You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sharad <sh...@persistent.co.in> on 2004/10/11 18:45:28 UTC

How to get the return value from the

Hi,

I want to create a target which can be called using <antcall />. But i want
to get the return value from the called target. Is there a way to get it?

I tried using ant contrib's variable property using <ac:var .../> but the
property value is not returned from the called target. Follows is the code
snipped i tried :

<project name="testing" default="args"
xmlns:ac="antlib:net.sf.antcontrib">
     <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

     <ac:var name="ret" value="0"/>
     <target name="args">
         <property name="argument1" value="one"/>
         <antcall target="function">
             <param name="arg1" value="${argument1}"/>
         </antcall>
         <echo message="functionReturnvalue = ${ret}"/>
    </target>

     <target name="function">
         <echo message="arg1 = ${arg1}"/>
         <ac:if>
             <ac:then>
                 <ac:var name="ret" value="1"/>
             </ac:then>
             <ac:else>
                 <ac:var name="ret" value="2"/>
             </ac:else>
         </ac:if>
     </target>
</project>

Thanks and Regards,
Sharad.


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


Re: How to get the return value from the

Posted by Christoph Bugel <cb...@netvision.net.il>.
Sharad wrote:

> Hi,
> 
> I want to create a target which can be called using <antcall />. But i want
> to get the return value from the called target. Is there a way to get it?
> 
> I tried using ant contrib's variable property using <ac:var .../> but the


antfetch and antcallback (from ant contrib) might do what you want.

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