tags:

views:

11

answers:

1

Hi people,

i try to write ant task, that do the following(pseudo code):

if(property1 == null)
   gets property1 from user input and saves this value(so when next time script will be executed the value must be used)
else
   use value

So, with another words, if i run script at the first time it must ask some value and save this value for future And the main thing it must be used only ANT CORE TASKS.

+1  A: 

You could try something like this:

  <target name="load-properties">
    <property file="test.properties" />
  </target>

  <target name="ask-user" unless="my-property" >
    <input
       message="Please provide property"
       addproperty="my-property" />
     <echo file="test.properties" message="my-property=${my-property}" />
  </target>

  <!-- try to load properties-file first, ask user if property is not found -->
  <target name="main" depends="load-properties, ask-user">
    <echo>${my-property}</echo>
  </target>
Peter Lang
It works perfekt, thanks!
Le_Coeur