ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert E. Newby" <>
Subject Re: Doubt in using ENTITY
Date Fri, 31 Oct 2003 16:47:21 GMT
Chen Becky wrote:

> Bob (Robert E. Newby),
> Your code sample is helpful for me as well.
> I have an extra requirement that I need to setup a property with
> different value based on some conditions.
> I wonder if I can have build-properties.xml looks like this:
>         <a>
>                 <property name="output-char" value="A"/>
>         <a/>
>         <b>
>                 <property name="output-char" value="B"/>
>         <b/>
>         <c>
>                 <property name="output-char" value="C"/>
>         <c/>
> But when I invoke "build-properties-file;" from build.xml, how can I
> tell build-properties.xml to run only <a>, <b> or <c>?
> I know this is more like XML question than ANT, any thoughts?
> Thanks.
> Becky


I am not exactly sure what you are trying to accomplish; perhaps you can
post a description of the context, etc. of your problem.

Regardless, take a look at the following snippet from one of our build


    <!-- set this property iff the condition is met, binding its value to
TRUE -->
    <condition property="setting-for-ui-in-development-mode" value="TRUE">
      <istrue value="${ui-in-development-mode}"/>

    <!-- set this property iff the condition is met, binding its value to
    <condition property="setting-for-ui-in-development-mode" value="FALSE">
      <isfalse value="${ui-in-development-mode}"/>


This makes use of the condition task.  Here, the tested property
ui-in-development-mode might have any string literal value, since it comes
from source configuration files.  I.e., it might be "t", "true", "y", "yes",
"false", "foobar", "becky", or whatever.  Only certain of these literals
equate to true; all others equate to false.

Thus each of the above two condition elements has the effect of defining a
**new** property named setting-for-ui-in-development-mode.  This new
property, which is the one we really make use of later in the build script,
will end up with the value TRUE or FALSE, depending on the istrue and
isfalse tests of the value of ui-in-development-mode.

My suggestion is that you take a look at the condition task.


Robert E. Newby

Principal Software Engineer
Vestmark, Inc.
500 Edgewater Drive, Suite 564
Wakefield, Massachusetts 01880 USA
781-224-3646 | Bob _ Newby @ vestmark . com | www . vestmark . com

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

View raw message