This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant -- referencing properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant -- referencing properties" Watch "Ant -- referencing properties" New topic
Author

Ant -- referencing properties

Matthew Sessoms
Greenhorn

Joined: Apr 28, 2011
Posts: 6
Hi,

I have an ant file and a property file. Say, for example, the property file contains properties 'a', 'b', and 'c'. The ant file takes command-line arguments, which should match either of the properties in the property file. Using the command-line arguments, I want to get the value of its corresponding property.

If ${input} contains the command-line argument, how do I reference ${input} so that it accesses ${a}? ${input} outputs 'a', and $${input} outputs ${input}, and ${${input}} outputs itself. If a=33, I want to be able to use 'input' so that I can access 33.

Thanks
Matt
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

I think that the PropertyCopy task in antcontrib will do what you want:
http://ant-contrib.sourceforge.net/tasks/tasks/index.html


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant -- referencing properties