File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant -- referencing properties" Watch "Ant -- referencing properties" New topic

Ant -- referencing properties

Matthew Sessoms

Joined: Apr 28, 2011
Posts: 6

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.

Peter Johnson

Joined: May 14, 2008
Posts: 5852

I think that the PropertyCopy task in antcontrib will do what you want:

JBoss In Action
I agree. Here's the link:
subject: Ant -- referencing properties
It's not a secret anymore!