Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant: Property inside or outside target?

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic