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 2004/07/07 21:26:24 UTC

DO NOT REPLY [Bug 29958] New: - propertyfile command line switch fails to expand properties internally

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=29958

propertyfile command line switch fails to expand properties internally

           Summary: propertyfile command line switch fails to expand
                    properties internally
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: jay@drummondsoftware.com


Here's a simple ant command line invocation:

ant -f buildfile.xml -propertyfile test.properties Help

When the test.properties file is read in and processed it will not expand (i.e. 
replace) properties that are defined inside this file elsewhere in the file. 

Contents of test.properties ------

serverLocation=/opt/server
serverConfige=${serverLocation}/httpd.conf

Contents of buildfile.xml ------

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="Help">
  <target name="Help" >
    <echo message="property serverConfigFile=${serverConfigFile}" />
    <echo message="property serverLocation=${serverLocation}" />
  </target>

  <target name="Loadem" >
    <loadproperties srcFile="test.properties"/>
  </target>

  <target name="Works" depends="Loadem,Help" />
</project>

running ANT
ant -f buildfile.xml -propertyfile test.properties Works
------ start ANT output -----
Buildfile: buildfile.xml

Loadem:

Help:
     [echo] property serverConfigFile=${serverLocation}/httpd.conf
     [echo] property serverLocation=/opt/server

Works:

BUILD SUCCESSFUL
Total time: 0 seconds
------ end ANT output -----

Loading the properties file with the loadproperties task does replace the 
internally defined values.

ant -f buildfile.xml Works
------- start ANT output ------
Buildfile: buildfile.xml

Loadem:

Help:
     [echo] property serverConfigFile=/opt/server/httpd.conf
     [echo] property serverLocation=/opt/server

Works:

BUILD SUCCESSFUL
Total time: 0 seconds
------- end ANT output --------

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