ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Murcott <si...@flaxx.net>
Subject Re: xmlproperty not expanding
Date Wed, 06 Jun 2012 23:38:45 GMT
Hi Ronald, if you look at the manual for XmlProperty you will find the
following statement:
"By default, this load does *no* processing of the input. In particular,
unlike the Property task <http://ant.apache.org/manual/Tasks/property.html>,
property references (i.e., ${foo}) are not resolved."

Unfortunately, the manual adds confusion here as the examples it provides
do not reflect this statement.

Also have a look at the echoproperties task, it helps a whole heap with
debugging properties.

http://ant.apache.org/manual/Tasks/xmlproperty.html
http://ant.apache.org/manual/Tasks/echoproperties.html

On 7 June 2012 01:23, Ronald Albury <ronalbury@gmail.com> wrote:

> 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}
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message