ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <>
Subject Re: <property file=... problem
Date Tue, 19 Feb 2002 18:28:56 GMT
From: "Lev Zak" <>

> I use ANT 1.4.1 on Windows 2000.
> I need to compare two properties (build number) that I take from a two
> different file.
> I have two installation in the different directory (d:/app1 and d:/app2)
> I would like to compare if this is the same build. For this I have a sign
> build number into the file under buildNumber key (e.g.
> buildNumber=200202031611).
> The part of build.xml target is a following:
> <target name="compare_build_number">
>     <property name="build.prop.1" value="d:/app1/"/>
>     <property name="build.prop.2" value="d:/app2/"/>
>     <property file="${build.prop.1}"/>
>     <property name="app1_ver" value="${buildNumber}"/>
>     <property file="${build.prop.2}"/>
>     <condition property="it_is_the_same_build">
>         <equals arg1="${app1_ver"}" arg2="${buildNumber}"/>
>     </condition>
> . . .
> I expected two defined values, app1_ver is a buildNumber of first
> application (d:/app1/ and buildNumber is a buildNumber of
> second application (d:/app2/, before a <condition> task
> I could to compare this values. But it is not happened.  The second
> "<property file=" does not work. I tried to separate this target to two
> different targets which use "<property file=" each one. It was not helped.
> tried to use "<property resource=" instead of "<property file=". It was
> helped.
> What is wrong in my build.xml?
> What I missed?
> And what is the difference between <property resource=" and "<property
> file=" ?

Here is a workaround for your situation:

    <property name="build.prop.1" value="d:/temp/app1/"/>
    <property name="build.prop.2" value="d:/temp/app2/"/>
    <replace file="${build.prop.1}" value="buildNumber.1">
      <replacefilter token="buildNumber"/>
    <property file="${build.prop.1}"/>
    <property file="${build.prop.2}"/>
    <condition property="it_is_the_same_build">
        <equals arg1="${buildNumber.1}" arg2="${buildNumber}"/>
    <replace file="${build.prop.1}" value="buildNumber">
      <replacefilter token="buildNumber.1"/>

> Lev.


*  Experience: The name men give to their mistakes.  *

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message