Hi,
forgot the replacement in my last mail =
given propertyfile test.props :
foo=bar
<script language="ruby">
<![CDATA[
#replace in your property file
# optionally create a new file just use
# a different outfile
infile = 'Y:/test.props'
outfile = 'Y:/test.props'
old = File.read(infile)
old.gsub!(/#{$foo}/, 'nobar')
File.open(outfile, "w") {|new| new.write(old)}
if infile == outfile
puts 'Modified = '<<infile<<' inplace'
else
puts 'Modified = '<<infile<<' to = '<<outfile
end
# reset for further ant processing
$project.setProperty "foo","nobar"
]]>
</script>
test.props afterwards :
foo=foobar
Regards, Gilbert
-----Original Message-----
From: jm [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 19, 2006 11:45 AM
To: Ant Users List
Subject: set a property in a .properties file
hi,
I have been looking for a way to set a property in a .properties file
via ant. Could not find any easy way...somebody knows a way to do it
or a external task or something?
I know about the <replace> stuff, but I am trying to change the
property without knowing the value it had before, that is, I cannot
assume it is '[EMAIL PROTECTED]@'
thanks,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]