ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: creating files
Date Mon, 11 Jun 2007 12:07:17 GMT
 
Hi,

-----Original Message-----
From: arijit [mailto:ghosh.arijit@wipro.com] 
Sent: Monday, June 11, 2007 1:27 PM
To: user@ant.apache.org
Subject: RE: creating files

/*
even if I load the property file, I can't see how I can read the key
value
pair from the property which is loaded and use it to replace the token
with
the read value...  any sample code ?
*/


some snippets =

two propertysources, one file that is loaded via loadfile the entire
file
is loaded in one property, and another file in key=value format.

message.txt looks like =

the quick
brown
fox
jumps over
the lazy
dog

props.txt looks like =

test.foo=bar
test.fooo=baar
test.key1=bla
test.key2=blabla
test.multilinekey =\n line1 \
\n line 2 \
\n line 3 \
\n line 4 \


notice the \n line \ convention if you need multiline properties

<!-- // Properties -->
<loadfile property="message" srcFile="Y:/message.txt"/>
<property file="Y:/props.txt"/>
<!-- Properties // -->


<target name="main" depends="depends">

<echo> $${message} = ${line.separator}${message}</echo>
<echoproperties prefix="test"/>
<echo>$${test.multilinekey} = ${test.multilinekey}</echo>

</target>


give you =

main:
     [echo] ${message} =
     [echo] the quick
     [echo] brown
     [echo] fox
     [echo] jumps over
     [echo] the lazy
     [echo] dog
[echoproperties] #Ant properties
[echoproperties] #Mon Jun 11 14:06:39 CEST 2007
[echoproperties] test.key2=blabla
[echoproperties] test.key1=bla
[echoproperties] test.multilinekey=\n line1 \n line 2 \n line 3 \n line
4
[echoproperties] test.foo=bar
[echoproperties] test.fooo=baar
     [echo] ${test.multilinekey} =
     [echo] line1
     [echo] line 2
     [echo] line 3
     [echo] line 4
BUILD SUCCESSFUL
Total time: 344 milliseconds

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


Mime
View raw message