ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Barker <>
Subject Failing if properties file not found
Date Thu, 23 May 2002 14:35:26 GMT

I am trying to build ant script that will fail in the case where a
particular properties file is not loaded, where the name of the properties
file is specified as a property on the command line.  I have tried the
following, which works fine if the file is not loaded, however it also fail
if I have a correct file specified.

Commands to run:

> ant (Fails as it should)
> ant -DEden.envfile=some_existing_file.props (Fails even though the file is
loaded, checked this through the verbose output).

	<property name="CONFIGDIR" value="${basedir}/Config"/>
  	<property name="Eden.envfile" value="[unspecified]"/>
   	<property file="${CONFIGDIR}/${Eden.envfile}"/>

 	<target name="check_envfile" unless="${Eden.envfile.set}">
 		<echo message="${Eden.envfile}"/>
 		<fail message="Enviroment file not specified, please specify
-DEden.evnfile=[filename] on the command line"/>
	<target name="build">
		<available file="${CONFIGDIR}/${Eden.envfile}"
		<antcall target="check_envfile"/>

I am probably missing something obvious, as I am a bit of a newbie.

Thanks in advance,

Michael Barker

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential / privileged material. If
you are not the intended recipient you must not review, distribute, or take
any action using this information. If you received this in error, please
contact the sender and delete the material from any computer. Singlepoint
(4U) Ltd may monitor outgoing and incoming e-mails and other
telecommunications on its e-mail and telecommunications systems.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message