aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant: Property inside or outside target? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant: Property inside or outside target?" Watch "Ant: Property inside or outside target?" New topic
Author

Ant: Property inside or outside target?

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i tried both with equal success, so i'm unsure about the right way of doing it
can someone please clarify it? here is an example:
outside:

inside:


thanks in advance


java amateur
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

Here is the difference:

If you declare a property outside of a target, that property will always be set before any target is executed.

If you declare a property within a target, that property will get set only when that target gets executed. The property value will be global, so it can be used within other targets.

Thus placing properties in a target is a a way of deciding which properties to set (by choosing to run on not run certain targets containing properties) and when to set them.

So there is no 'right' or 'wrong' about this. It is mostly about what you want to accomplish, and could even be a matter if style.


JBoss In Action
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Peter Johnson wrote:If you declare a property within a target, that property will get set only when that target gets executed. The property value will be global, so it can be used within other targets.

looks more intuitive the other way, i mean, being global when declared outside, but ok

thanks a lot, Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant: Property inside or outside target?