ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: <ftp> target does not fail if file does not exist.
Date Thu, 04 Aug 2011 14:55:15 GMT
On 2011-08-02, Oleksandr Gavenko wrote:

> <?xml version="1.0" encoding="windows-1251"?>
> <project default="test" basedir=".">

>     <target name="test">
>         <ftp action="get"
>              server="${ftp.server}"
>              userid="${ftp.user}"
>              password="${ftp.password}"
>              remotedir="/dist">
>             <fileset file="lib/my.jar"/>
>         </ftp>
>       <echo message="xxx"/>
>     </target>
> </project>

>   $ ant -f my2.xml -emacs
> Buildfile: d:\test.xml

> test:
> getting files
> 0 files retrieved
> xxx

> I expect that build fail as 'my.jar' is not exist and 'echo' does not
> executed.

<fileset> is the set of files that actually exist limited by the
patterns you provide.  It won't fail if the file doesn't exist, it is
its contract to accept that some things you specify may or may not be
there.

I'm afraid that if you want the task to fail you first have to check the
file is actually there (doing a list and searching through the output)
or check it has been downloaded using <available> after the ftp task.
I'd go for available.

Stefan

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


Mime
View raw message