Ant var and property scope
        Posted  
        
            by bobtheowl2
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by bobtheowl2
        
        
        
        Published on 2010-02-03T14:40:21Z
        Indexed on 
            2010/06/07
            13:52 UTC
        
        
        Read the original article
        Hit count: 292
        
ant
I have a main build script that calls various targets. One of these targets needs to store a value and another target needs to display it. Obviously this is not working so I think it may be related to scope. I've tried var, property, and declaring the property outside of target1. Since var seems to be mutable, it looks like I need to use it instead, but each time my output is empty.
Main script
<antcall target="target1"/>
<antcall target="display"/>
In target1:
<var name="myVar" value="${anotherVar}"/>
In display:
<echo>${myVar}</echo>
© Stack Overflow or respective owner