You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Edwin Park <es...@parkplace.dhs.org> on 2000/03/12 04:56:16 UTC

conditional build

Hi,

Can ANT be used to build targets depending on the value of a particular
property?  For instance, I would like to have different build behavior
depending on the value of the java.specification.version property.  There
seem to be only two ways of doing conditional stuff with ANT - using the
'if' property in <target>, and using the <available> task.  Both are
conditional on the existence of a property, not its value.  It seems that
I would have to create my own task in order to implement the behavior I
need.

The following description of the <target> directive seems misleading to
me:

A target has also the ability to perform its execution if a property has
been set. This allows, for example, better control on the building process
depending on the state of the system (java version, OS, command line
properties, etc...). To make target sense this property you should add the
if attribute with the name of the property that the target should react
to, for example...

because control of the build process depending on java version and OS
implies to me 'if prop=val' semantics, rather than merely 'if prop
exists'.  Have I overlooked some other method of doing conditional builds?

Edwin