You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/09/25 10:14:16 UTC

DO NOT REPLY [Bug 23404] New: - Allow Ant command-line property files to be loaded using variable substitution.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23404>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=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.
           Product: Ant
           Version: 1.5.4
          Platform: PC
               URL: http://jakarta.apache.org/log4j/docs/api/org/apache/log4
                    j/PropertyConfigurator.html
        OS/Version: Windows XP
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: telcik@iinet.net.au


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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org