ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Rich" <>
Subject RE: how can I change value of property in runtime?
Date Thu, 25 Aug 2005 14:48:59 GMT
I think part of the answer to this question is another question - why do you
need to change the value of the property?

In Ant properties are immutable. The targets are rule based which implies
that all rules have an equal chance of firing based on the conditions at the
time of evaluation.

Can you design the solution to fit in these guidelines? If not, antcontrib
offers some help by providing some if-then-else like constructs that can be
used. This also includes a variable construct that can change the value at
run time.

HTH Bill 

-----Original Message-----
From: Taner Diler [] 
Sent: Thursday, August 25, 2005 3:51 AM
To: Ant Users List
Subject: how can I change value of property in runtime?


I have a problem with properties that defined in xml. I'm  reading a
property (has "test-0" value) from properties file and I try to change its
value by using ' <property name="${LOGICAL_SON_ISLEM_DIZINI}"

when I display value of the property by using echo, "test-0" is still being
displayed.  How can I change value of the property in runtime?

<?xml version="1.0" ?>
<project name="structured" default="READER_CALLER" >
    <property name="SEPARATOR" value=";"/>
    <property name="rtdir" value="D:\\riskturk"/>
    <property name="RTDIR" value="D:\\riskturk"/>
    <property name="" value="KREDIRISK"/>
    <property name="" value="CREDIT_IMPORTER"/>
    <property name="credit_importer.path" 
    <property name="tomcat.home"  value="C:\\TOMCAT"/>
    <property name="lib.home" 
    <property name="credit_importer.porperties.file" 

    <path id="project.class.path">
path="${rtdir}\\${}\\WEB-INF\\classes" />
        <fileset dir="${lib.home}">
            <include name="*.jar"/>
        <fileset dir="${tomcat.home}\\common\\lib">
            <include name="servlet.jar"/>
    <!-- ${credit_importer.porperties.file} has ${LOGICAL_SON_ISLEM_DIZINI}
property. -->
    <target name="READ_FROM_PROPERTY_FILE">
        <property file="${credit_importer.porperties.file}"/>
        <!-- read ${LOGICAL_SON_ISLEM_DIZINI} property from property file.
        <!-- write ${LOGICAL_SON_ISLEM_DIZINI} property to screen as
        <echo message="${LOGICAL_SON_ISLEM_DIZINI}"/>

    <target name="READER_CALLER" depends="READ_FROM_PROPERTY_FILE">
        <!-- change value of ${LOGICAL_SON_ISLEM_DIZINI} property to
"test-1"  in runtime -->
        <property name="${LOGICAL_SON_ISLEM_DIZINI}" value="test-1"/>
        <!-- but it is still writing "test-0" to screen -->
        <echo message="${LOGICAL_SON_ISLEM_DIZINI}"/>

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

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

View raw message