You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sebastian ssmoller <se...@gmx.net> on 2004/08/10 18:22:35 UTC

Interesting behaviour

hi,
first: i am not subscribed to the list so please use "reply to all" or
add my private email addr to the cc list - thx.

i discovered the following interesting behaviour. i do not know whether
it is "defined"/expected or a bug so i decided to ask :)

i have two build scripts

----- a.xml -----
<project name="a">

    <property name="var" value="global"/>

    <target name="call">
        <ant antfile="b.xml" inheritall="false" target="echo"/>
    </target>

    <target name="caller">
        <antcall target="call">
            <param name="var" value="UPS :("/>
        </antcall>
    </target>

</project>
----- a.xml -----


----- b.xml -----
<project name="b">

    <target name="echo">
        <echo message="something to say : ${var}"/>
    </target>

</project>
----- b.xml -----

so know when i call:

$ ant -f a.xml call

i get the expected result that the ${var} is not evaluated but when i do

$ ant -f a.xml caller 

${var} evaluates to "UPS :(" 

is this expected behaviour ? Why ? I thought setting "inheritall=false
would not "forward" any property to the new env...


thx
regards,
seb

-- 
"Perfection is achieved, not when there is nothing left to add, 
but when there is nothing left to take away."  
--- Antoine de St. Exupery, Wind, Sand, and Stars, 1939 

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


Re: Interesting behaviour

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 10 Aug 2004, sebastian ssmoller <se...@gmx.net>
wrote:

> is this expected behaviour ?

Yes.

> Why ?

Nested <property> elements of <ant> and <param> elements of <antcall>
essentially become equivalent to properties you define on the command
line.  These are special properties and they will always get passed
down, even through additional <*ant*> tasks with inheritall set to
false.

> I thought setting "inheritall=false would not "forward" any property
> to the new env...

It will forward all properties defined on the command line or defined
by a <*ant*> task as nested element that invoked the current build
file (and recursively higher up until we reach the initial build
file).

Stefan

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