ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pomè Elisabetta <>
Subject R: R: global variables
Date Thu, 30 Aug 2007 15:39:24 GMT
I had the suspect that I was trying to use ant out of the purpose.
But I wrote a very big script without problem. Now I was trying to improve
the script (for example if I jar the content of a directory the first time I
enter in a foreach loop, maybe I would like not to jar the same directory,
say, the third time I enter the loop, due to same condition) and to add some
not so usefull check (my client shoul do that check themselves).
Thank you the same.

-----Messaggio originale-----
Da: Dominique Devienne []
Inviato: giovedì 30 agosto 2007 17.20
A: Ant Users List
Oggetto: Re: R: global variables

On 8/30/07, Pomè Elisabetta <> wrote:
> Thank you, but I'm not sure I have understood.
> If I have 3 target (target A with an antcall to target B and 
an antcall to
> another target C) and I define a property in target B I can't 
see its value
> in target C. So I thought that properties have the scope of 
the target in
> which they're defined. Am I wrong?
> But my problem is different 'cause I need to change a value 
due to some
> condition in order to decide a behavior. I have a foreach 
loop: inside that
> loop I have to set "something" (a property? I don't think, 
'cause properties
> are immutable) when I found a certain condition. Each time I 
enter the loop
> I need to test this "something" in order to understand 
whether continue or
> end the loop.

It sounds (antcall chain, foreach loops) like you are trying to use
Ant as an imperative scripting language with method calls and
variables. Ant is not designed for this, and although it has some
support for these constructs, you are using it "against the grain",
which leads to issues (because of property immutability).

Ant "way" is declarative, where high level targets *depend* on lower
level targets (as opposed to antcalling other targets), and loops are
usually built in to tasks, not explicit.

Rather that asking questions about using the scripting features of
Ant, tell us what you are trying to achieve at a higher level and we
may be able to point you to facilities in Ant that could achieve them.

There are things that Ant can't do out-of-the-box, but then one
switches to a real scripting language to achieve them (using <script>
or <scriptdef>), or to writing custom tasks in Java. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message