ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Condition task to print message
Date Fri, 08 Aug 2003 15:27:08 GMT
Oh yeah, sorry, I was of track with <fail>...

Too bad some pundits think adding if/unless to <echo> or all tasks in
general is such a bad thing, or simply because 'they' don't need it, as you
would not have to create any targets at all!!!

Because of this, you can do <available>+<fail if="...">, but not
<available>+<echo if="...">.

I use <if> all the time (OK, sometimes), but that doesn't mean the above is
not a good use case. --DD

> -----Original Message-----
> From: McDonnell Colm [mailto:Colm.McDonnell@uk.mizuho-sc.com]
> Sent: Friday, August 08, 2003 10:22 AM
> To: 'Ant Users List'
> Subject: RE: Condition task to print message
> 
> try this:
> 
> <target name="file-exists">
>   <available file="theFile" type="file" property="file.exists"/>
> </target>
> 
> <target name="check-file" depends="file-exists" if="file.exists">
>   <echo message="in check-file target with file.exists=${file.exists}"/>
> 
> </target>
> 
> if theFile exists Ant will return this:
> 
> check-file:
>      [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 [SMTP:matthewoatham@hotmail.com]
> > Sent:	Friday, August 08, 2003 4:10 PM
> > To:	user@ant.apache.org
> > 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
> > http://www.msn.co.uk/messenger
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 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 error
> please delete it and any files transmitted with it, after notifying
> postmaster@uk.mizuho-sc.com
> Any opinions expressed in this message may be those of the author and not
> necessarily those of
> 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 the
> 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 headed
> by Mizuho Financial Group, Inc.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message