-----Original Message-----
From: Simple Easy [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2008 5:53 AM
To: [email protected]
Subject: How can I override property value?
/*
Hi,
I would like to override the property value entered by <INPUT> task. How
can I go about doing that?
*/
/*
<property name="version" value="" />
*/
that's wrong if you want to fill the version property with <input> task
in ant properties are normally immutable after they have been set
so here ${version} would be "" as it doesn't get overwritten with
<input>
instead you simply create and fill the version property with <input>
task
/*
<input message="Please enter the version number:" addproperty="version"
/>
*/
overwriting properties =
beside the <var> task from antcontrib, you may use the <script> task
combined
with a VM / BSF compatible language and use the ant api, f.e.
<project name="bla" default="main" basedir=".">
<target name="depends">
<input message="Please enter version :" addproperty="version"/>
<echo>$${version} == ${version}</echo>
</target>
<target name="main" depends="depends">
<script language="ruby">
<![CDATA[
a = ['v_2_3_4','v_1_2_2','v_1_2_3']
$project.setProperty "version", a[rand(a.size)]
]]>
</script
<echo>$${version} == ${version}</echo>
</target>
depends:
[echo] ${version} == v_4_5_6_7
main:
[echo] ${version} == v_2_3_4
BUILD SUCCESSFUL
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]