Definir parámetro antes de llamar a la tarea dependiente en Ant

I want to define parameter before calling to the target of the depends task for example:

<target name="init">
...
If (mode=true)
  Then...
       Else...
      ...
       </target>
<target name="Create File" depends="init">
...
       ...
       </target>

I want to define parameter called mode and give it for example true value and I want to do it once I started the "Create File" before calling the depends="init" task because I want the Init task to use this parameter

Can I do this in Ant?

Muchas Gracias

preguntado el 08 de noviembre de 11 a las 19:11

1 Respuestas

You can't do this if you are using depends, but you can execute init target through antcall task.

Here is an example from the above link

<target name="Create File">
  <antcall target="init">
    <param name="param1" value="value"/>
  </antcall>
</target>

<target name="init">
  <echo message="param1=${param1}"/>
</target>

respondido 09 nov., 11:04

Thanks for your answer another small question : can i add another traget:mytarget is it called before init? is Ant call the traget by order? <target name="Create File" depends="mytarget,init"> - Etiqueta azul

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.