ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amnon Khen" <amnon.k...@cash-u.com>
Subject RE: Reading and Writing of String
Date Mon, 02 Aug 2004 08:18:01 GMT
Hi,
A simpler way, IMHO, is:
+ load the property value using the <property> task
+ have Ant modify the java file by using filtered copying:
<copy ...>
	<filterset>
      	<filter token="VERSION-DATE" value="${build-date}"/>
	</filterset>
</copy>
+ Of course, the java file should include the VERSION-DATE token
HTH,
	Amnon
-----Original Message-----
From: Eduardo Andrés Alfonso Sierra [mailto:ed_alfon@spymac.com] 
Sent: Sunday, August 01, 2004 8:19 PM
To: Ant Users List; pritesh@sqatester.com
Subject: Re: Reading and Writing of String

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




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


Mime
View raw message