ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eduardo Andrés Alfonso Sierra <ed_al...@spymac.com>
Subject Re: Reading and Writing of String
Date Sun, 01 Aug 2004 18:18:43 GMT
I would do it like this (however, other solutions must exist and could be
better, this is just my way)

load the properties file using

        <property file="ui.properties"/>

now you can access the value of you build-date property this way

        ${build-date}

then you can use replaceregexp to change the value of the version_Date
variable within the java file

        <replaceregexp  file="javaFile">
                <regexp pattern="String version_Date=(.*?);"/>
                <substitution expression="String
version_Date=&quot;${build-date}&quot;;"/>
        </replaceregexp>


This way could work, I think you can easily adapt it to you case.




----- Original Message ----- 
From: "Pritesh saharey" <pritesh@sqatester.com>
To: <user@ant.apache.org>
Sent: Sunday, August 01, 2004 11:52 AM
Subject: Reading and Writing of String


> Hi All,
>        I need a help regarding reading and writing to a file. There is a
file ui.properties which looks something like this
>
>        build-date= AmarGeet_0098_20040812
>
>        now i want to read this value of variable 'build-date' and write it
to a 'String' variable in a java file
>
>        String version_Date="";
>
>        and this process has to be done before the compliation of java
files, is there any way in ant to do this process.
>
>
>        so what need to be done here can anybody help me out, I will be
thankful to you.
>
>
>
> Pritesh Saharey
> BE(Mech)
> <a href="http://www.ntsearch.com/search.php?q=Software&v=56">Software</a>
Engineer
>
>
> _____________________________________________________________
> Join SQAtester.com Community  --->
http://www.sqatester.com/testersarea/joinus.htm
>
> ---------------------------------------------------------------------
> 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