There are several ways this can be done:
One is to use multiple tasks:
<target name="compile">
<antcall target="compile.dev"/>
<antcall target="compile.release"/>
</target>
<target name=compile.dev"
if="mode.dev">
<property name="build.classes" value="${build}/dev/classes"/>
</target>
<target name="compile.release"
unless="mode.dev">
<property name="build.classes" value="${build}/release/classes"/>
</target>
In the example you gave, you could simply set the property "type" to
either "dev" or "release":
<property name="build.classes" value="${build}/${type}/classes"/>
You can also use separate XML property files:
<xmlproperty file="build.${type}.xml" keeproot="false"/>
Or, you can use the antcontrib library which includes a conditional
"if" statement. If you do this, I would put the ant-contrib.jar file
in a directory called "antlib" in the root of your project and use the
following <typedef>:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/antlib/ant-contrib.jar"/>
</classpath>
This way, ant will work without having to specifically install the
ant-contrib.jar file.
You can find Ant-Contrib at: http://ant-contrib.sourceforge.net
The <if> task looks like this:
<if>
<isset property="type">
<then>
<property name="build.classes" value="${build}/dev/classes"/>
</then>
<else>
<property name="build.classes" value="${build}/release/classes"/>
</else>
</if>
--
David Weintraub
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]