Bug 23404 - Allow Ant command-line property files to be loaded using variable substitution.
Summary: Allow Ant command-line property files to be loaded using variable substitution.
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.8.1
Hardware: PC All
: P3 major with 2 votes (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL: http://jakarta.apache.org/log4j/docs/...
Keywords:
: 23405 25169 29958 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-09-25 08:14 UTC by Tim Telcik
Modified: 2011-06-17 08:51 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Telcik 2003-09-25 08:14:15 UTC
APACHE ANT 1.5.4 ENHANCEMENT REQUEST
(Thrusday 25 September 2003)

The Apache Ant tool could be enhanced by allowing property values to be
substituted when loading them from the command-line using the Ant
"-propertyfile" argument.

To illustrate, consider running Ant from the command-line ...

> ant -propertyfile config.properties <TARGET>

where the proeprty file "config.properties" could contain entries

server.home=c:\server
server.lib=${server.home}\lib
admin.user.home=${user.home}

The property "server.lib" would evaluate to "c:\server\lib" while property
"admin.user.home" could evaluate to "basil" if the Java system property
"user.home" evaluated to "basil".

A more formal description of this functionality can be seen in the following
excerpt, taken from the header of class 
"org.apache.log4j.PropertyConfigurator" in Apache Log4j 1.2.8 ...

"All option values admit variable substitution. The syntax of variable
substitution is similar to that of Unix shells. The string between an opening
"${" and closing "}" is interpreted as a key. The value of the substituted
variable can be defined as a system property or in the configuration file
itself. The value of the key is first searched in the system properties, and if
not found there, it is then searched in the configuration file being parsed. The
corresponding value replaces the ${variableName} sequence. For example, if
java.home system property is set to /home/xyz, then every occurrence of the
sequence ${java.home} will be interpreted as /home/xyz."


I am volunteering to complete this piece of work as I require this functionality
for an existing Ant property file.


Tim Telcik
telcik@iinet.net.au
Comment 1 Jan Mat 2003-09-25 08:20:02 UTC
*** Bug 23405 has been marked as a duplicate of this bug. ***
Comment 2 Jan Mat 2003-12-09 11:22:37 UTC
*** Bug 25169 has been marked as a duplicate of this bug. ***
Comment 3 Jan Mat 2004-07-08 04:46:09 UTC
*** Bug 29958 has been marked as a duplicate of this bug. ***
Comment 4 Hendy Irawan 2011-06-17 08:51:28 UTC
This should be a bug, not just a feature request. Still reproducible on Ant 1.8.1.

http://ant.apache.org/manual/Tasks/property.html doesn't mention that -propertyfile is an "inferior" version of <property file=/>

-propertyfile should be processed in similar way as <property file=/> with full property substitution/expansion.