File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Odd behavior when loading properties with ant

 
David Brossard
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you put the option first, and don't specify the build file incorrectly?
 
Misha Ver
Ranch Hand
Posts: 470
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's kind of what I said.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic