Two Laptop Bag*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 5812
    
    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
 
Similar Threads
How to EXEC each line in a file?
Properties xml file
Ant integration with Eclipse [Build.Properties]
Overriding part of property name
Ant: How do I access a proeprty within a property?