ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Rich" <b...@wilandra.com>
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 [mailto:tanerd@riskturk.com] 
Sent: Thursday, August 25, 2005 3:51 AM
To: Ant Users List
Subject: how can I change value of property in runtime?

Hi,

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}"
value="test-1"/>'.

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="credit_context.name" value="KREDIRISK"/>
    <property name="credit_importer.name" value="CREDIT_IMPORTER"/>
    <property name="credit_importer.path" 
value="${rtdir}\\${credit_importer.name}"/>
    <property name="tomcat.home"  value="C:\\TOMCAT"/>
    <property name="lib.home" 
value="${rtdir}\\${credit_context.name}\\WEB-INF\\lib"/>
    <property name="credit_importer.porperties.file" 
value="${rtdir}\\${credit_importer.name}\\conf\\configuration.properties"/>

    <path id="project.class.path">
        <pathelement
path="${rtdir}\\${credit_context.name}\\WEB-INF\\classes" />
        <fileset dir="${lib.home}">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${tomcat.home}\\common\\lib">
            <include name="servlet.jar"/>
        </fileset>
    </path>
   
    <!-- ${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
"test-0"-->
        <echo message="${LOGICAL_SON_ISLEM_DIZINI}"/>
    </target>

    <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}"/>
    </target>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message