ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject [PATCH] added unless attribute to target
Date Tue, 30 May 2000 15:21:08 GMT

1. Sometimes it easier to check for the absence instead of the presence
of something. For example

<available property="windows" file="c:\autoexec.bat" />
<target name="test" unless="windows">

would execute target test only on non Microsoft systems (silly
example, I know).

2. Sometimes you have two alternative ways to do something:

<target name="dowork" depends="way1,way2">
<target name="way1" if="way1ispossible">
<target name="way2" unless="way1ispossible">

3. You want to produce different things depending on your build

Let's assume I want to build a JDBC driver and I have both the 1.0
version and the 2.0 version in the same source tree - I still want to
support JDBC 1.0. The 1.0 version won't compile on JDK 1.2 and the 2.0
version not on JDK 1.1, so:

<available property="java2" classname="java.lang.ThreadLocal" />
<target name="build" depends="jdbc1,jdbc2" />
<target name="jdbc1" unless="java2">
<target name="jdbc2" if="java2">


View raw message