ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From McDonnell Colm <>
Subject RE: Condition task to print message
Date Fri, 08 Aug 2003 15:22:25 GMT
try this:

<target name="file-exists">
  <available file="theFile" type="file" property="file.exists"/>	

<target name="check-file" depends="file-exists" if="file.exists">
  <echo message="in check-file target with file.exists=${file.exists}"/>


if theFile exists Ant will return this: 

     [echo] in check-file target with file.exists=true

if theFile does not exist you Ant will return nothing

if you want to use an if.. else construct rather than linking two targets
via depends and if properties then look at the optional tasks provided by
Antelope or ant-contrib

> -----Original Message-----
> From:	Matthew Oatham []
> Sent:	Friday, August 08, 2003 4:10 PM
> To:
> Subject:	Condition task to print message
> Hi,
> During a build I need to check for the existence of a file and want to
> alert 
> the user if this file doesnt exist. I guess I can use the available task
> to 
> see if the file exists but then if it doesnt how do I print a message.
> It's 
> like this:
> if ( ! file exists ) {
>   print warning
> }
> Thanks
> Matt
> _________________________________________________________________
> Use MSN Messenger to send music and pics to your friends 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

This message and any files transmitted with it are confidential and intended solely for the
use of 
the individual or entity to whom they are addressed.  If you have received this message in
please delete it and any files transmitted with it, after notifying
Any opinions expressed in this message may be those of the author and not necessarily those
the company.  The company accepts no responsibility for the accuracy or completeness of any

information contained herein.  This message is not intended to create legal relations between
company and the recipient.
Recipients should please note that messages sent via the Internet may be intercepted and that

caution should therefore be exercised before dispatching to the company any confidential or

sensitive information.

Mizuho International plc
Bracken House, One Friday Street, London EC4M 9JA. TEL. 020 7236 1090
Registered in England No. 1203696. Registered office as above. Authorised and regulated by
the Financial 
Services Authority. A member of the London Stock Exchange. A member of Mizuho Financial Group
by Mizuho Financial Group, Inc. 

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

View raw message