ANT antcall a target that defines a property

Posted by alem0lars on Stack Overflow See other posts from Stack Overflow or by alem0lars
Published on 2011-03-11T16:39:23Z Indexed on 2011/03/12 0:10 UTC
Read the original article Hit count: 146

Filed under:

In ANT I want to define a target (called A) that define a property and antcall it from another target (called B). I want that the target B, after antcalling the target A, can access to the property defined in the target A.

For example:

<target name="B">
    <antcall target="A" inheritAll="true" inheritRefs="true" />
    <echo>${myprop}</echo>
</target>
<target name="A">
    <property name="myprop" value="myvalue" />
</target>

However it doesn't work and <echo>${myprop}</echo> doesn't print myvalue (I think because the property myprop isn't defined in B).

Is there any way to do that?

Thanks..

© Stack Overflow or respective owner

Related posts about ant