ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: How Do I do conditionally set a prop (not OS specific prop).
Date Thu, 29 Mar 2001 14:18:51 GMT
Fred Welland <> wrote:

> I have a Exec target like the follwoing:
> <target name="my_target">
>     <property name="my_path" refid="some.other.path"/>
>     <exec    dir="${outdir}"
>                    excutable="${my_bin}/my_prog"
>                    failonerror="yes">
>                     <arg line="-debug -p ${my_path} parm1 parm2"/>
>     </exec>
> </target>\
> I would like to conditionally include the "-debug" flag.  I am
> already using a props file where we have a property called
> "be_verbose" which is used on delete tasks (e.g <delete
> verbose="${be_verbose}" ..../>).  I would like this property to
> controll the inclusion of the -debug flag on the exec arg line.

You'll need something hacky like this

<property name="debug.${be_verbose}" value="1" />

<target name="with.debug" if="debug.true">
  <property name="cmdline" value="-debug " />

<target name="without.debug" unless="debug.true">
  <property name="cmdline" value="" />

<target name="exec" depends="with.debug,without.debug">
  <exec dir="${outdir}"
     <arg line="${cmdline}-p ${my_path} parm1 parm2"/>


View raw message