Don't worry, fixed:

<target name="check_envfile" unless="${Eden.envfile.set}">

should be:

<target name="check_envfile" unless="Eden.envfile.set">

Knew it was simple.

-----Original Message-----
From: Michael Barker [mailto:[EMAIL PROTECTED]]
Sent: 23 May 2002 15:35
To: Ant Users List (E-mail)
Subject: Failing if properties file not found


Hi,

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>
 
        <target name="build">
                <available file="${CONFIGDIR}/${Eden.envfile}"
property="Eden.envfile.set"/>
                <antcall target="check_envfile"/>
        </target>


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

Thanks in advance,

Michael Barker
Email: [EMAIL PROTECTED]


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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to