My understanding is that the xmlproperty task is supposed to expand
references to external properties just like the regular property task
does.  However, it does not seem to work for me.  The output below is from
ant 1.7 - however I have downloaded the latest ant and it has the same
issue.

*Here is my ant file:*
<project name="test" default="show">

    <property name="global.demo" value="i am global demo"/>

    <xmlproperty keepRoot="true" file="props.xml"/>
    <property file="props.properties"/>

    <target name="show">
        <echo>ant.version = ${ant.version}</echo>
        <echo>ant.java.version = ${ant.java.version}</echo>
        <echo>java.vendor = ${java.vendor}</echo>
        <echo>java.version = ${java.version}</echo>

        <echo message="cmd.demo property = ${cmd.demo}"/>
        <echo message="global.demo property = ${global.demo}"/>
        <echo message="props.demo property = ${props.demo}"/>
        <echo message="xml.demo property = ${xmlTest.demo}"/>

        <echo message="props.cmd property = ${props.cmd}"/>
        <echo message="props.global property = ${props.global}"/>

        <echo message="xml.cmd property = ${xmlTest.cmd}"/>
        <echo message="xml.global property = ${xmlTest.global}"/>
    </target>

</project>

*Here is the regular property file:*
props.demo = This is properties demo
props.cmd = This is properties with cmd ${cmd.demo}
props.global = This is properties with global ${global.demo}

*Here is the xml property file:*
<xmlTest>
    <demo>This is xmlTest demo</demo>
    <cmd>This is xmlTest with cmd ${cmd.demo}</cmd>
    <global>This is xmlTest with global ${global.demo}</global>
</xmlTest>

*Here is the output  when I run with -Dcmd.demo="i am command demo" *
show:
     [echo] ant.version = Apache Ant version 1.7.1 compiled on June 27 2008
     [echo] ant.java.version = 1.6
     [echo] java.vendor = IBM Corporation
     [echo] java.version = 1.6.0
     [echo] cmd.demo property = i am command demo
     [echo] global.demo property = i am global demo
     [echo] props.demo property = This is properties demo
     [echo] xml.demo property = This is xmlTest demo
     [echo] props.cmd property = This is properties with cmd i am command
demo
     [echo] props.global property = This is properties with global i am
global demo
     [echo] xml.cmd property = This is xmlTest with cmd ${cmd.demo}
     [echo] xml.global property = This is xmlTest with global ${global.demo}

Reply via email to