xmlproperty not expanding
1 posts in topic
Thread View Thread View

xmlproperty not expanding...
Tue Jun 05, 2012 02:13 PM

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.

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.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}"/>


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}

    <demo>This is xmlTest demo</demo>
    <cmd>This is xmlTest with cmd ${cmd.demo}</cmd>
    <global>This is xmlTest with global ${global.demo}</global>

Here is the output  when I run with -Dcmd.demo="i am command demo"
     [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}


 Despite examples to the contrary in the Ant docume...

Thu Jun 07, 2012 05:49 AM

Despite examples to the contrary in the Ant documentation - xmlproperty does *NOT* do expansion.  I have suggested, on the Apache Ant user maillist, that this be considered a bug.

About | Sitemap | Contact