ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <Juergen.Knuple...@icongmbh.de>
Subject AW: param hierarchy inverse to property hierarchy
Date Wed, 12 Nov 2008 16:41:30 GMT
Hello,

Again: The behaviour of ANT is ok, because you need this very often!

If you have no access at all to ant1.xml and this script is holy, so that no one is allowed
to change it and you need to call target t1, then there is no way to change foo for target
t2.

But...
You import ant1.xml, therefore you have power over ant1.xml. 
E.g. you can change ant1.xml before you import it or:

What you could do is:
1.Instead of importing t1 you can use <ant> to call the target t2 directly.

Best solution is:
Talk to the owner of ant1.xml and ask him to change ant1.xml in the following way:

=== ant1.xml ===
<target name="t1">
        ... do something
<property name="paramproperty" value"bar"
<property name="foovalue" value"${paramproperty}"
        <antcall target="t2">
                <param name="foo" value="${paramproperty}" />
        </antcall>
        ... do something
</target>
<target name="t2">
        ... do something
</target>
=== ant1.xml ===

This will not change the behaviour of ant1.xml, except someone changes ${paramproperty}

And exactly this is, what you will do:
=== ant2.xml ===
<import file="ant1.xml" />
<target name="main">
        <antcall target="t1">
                <param name="paramproperty" value="myvalue" />
        </antcall>
</target>
=== ant2.xml ===

This will do the trick...

-- 
Jürgen Knuplesch 

-----Ursprüngliche Nachricht-----
Von: Dieter König [mailto:Dieter.Koenig@data-experts.de] 
Gesendet: Mittwoch, 12. November 2008 16:53
An: user@ant.apache.org
Betreff: Re: param hierarchy inverse to property hierarchy

Hi,

i expected that i will be missunderstood :(. So again:
=== ant1.xml ===
<target name="t1">
        ... do something
        <antcall target="t2">
                <param name="foo" value="bar" />
        </antcall>
        ... do something
</target>
<target name="t2">
        ... do something
</target>
=== ant1.xml ===

=== ant2.xml ===
<import file="ant1.xml" />
<target name="main">
        <antcall target="t1">
                <param name="foo" value="myvalue" />
        </antcall>
</target>
=== ant2.xml ===

Suppose i have no write access to ant1.xml but i have to use it. 
Furthermore i have to call the target "t1" (and not "t2" directly where passing the parameter
would work) because all the other logic of "t1" 
should be used also. This way to pass "myvalue" as a value of "foo" doesnt work. And i didnt
found a way else.
That's why in my opinion the behaviour of ant should be changed. Or do has somebody a solution
for this problem?

Kind Regards
Dieter König

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


Mime
View raw message