This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Odd behavior when loading properties with ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Odd behavior when loading properties with ant" Watch "Odd behavior when loading properties with ant" New topic
Author

Odd behavior when loading properties with ant

David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109

One can use variables inside variables in an ant build properties file e.g.


The above statement works if and only if the properties file is referenced to from within the build.xml file with the usual


If I use ant build.xml -propertyfile foo.properties, then it doesn't replace ${lib.dir} with the right value. Why???

This seems to be a bug for me.


No matter what they say in Ohio, we're still first in flight!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What if you put the option first, and don't specify the build file incorrectly?
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
David Brossard wrote:
ant build.xml -propertyfile foo.properties


It should not work at all. The correct call would be



or

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's kind of what I said.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Maybe it is just me, but I think that the command line syntax is a red herring: http://faq.javaranch.com/java/AvoidRedHerrings

My recommendation is to look at the Ant source code, see why the behavior is as you describe (I have verified that it works as you said), and then open an issue report with Ant, submitting the patch to fix it.


JBoss In Action
 
Don't get me started about those stupid light bulbs.
 
subject: Odd behavior when loading properties with ant
 
Similar Threads
[junit] java.lang.ClassNotFoundException: UserActivityTest
Problems creating the Struts 2 application, with Ant to build the application.
run time loading of properites
Trying to invoke javadoc tag within Ant problem.
Ant build fail, sometimes 'cause ant forgets property