ant 解压缩任务:如果解压缩失败,为什么它不会失败?

ant unzip task: Why does it not fail, if unzipping fails?

我在自定义编写的安装程序中使用 groovy AntBuilder,例如。解压安装包。 我无法弄清楚的一件事是如何检测解压缩任务是否失败,例如。 我有以下代码:

...
AntBuilder antBuilder = new AntBuilder()
antBuilder.mkdir(dir:installationPath)
antBuilder.unzip(src:zipFileName, dest:installationPath,overwrite:"yes")
...

如果目标路径 ("installationPath") 被写保护,解压会报告错误 ("unable to expand..."),但任务本身不会失败。解压缩也没有 "failOnError" 属性。

如果目标被写保护(或驱动器已满等),是否有办法强制解压缩任务失败?

好像没有办法捕获异常。

根据蚂蚁的源码

    protected void extractFile(FileUtils fileUtils, File srcF, File dir,
                               InputStream compressedInputStream,
                               String entryName, Date entryDate,
                               boolean isDirectory, FileNameMapper mapper)
                               throws IOException {

...........................
...........................
...........................


        } catch (FileNotFoundException ex) {
            log("Unable to expand to file " + f.getPath(),
                    ex,
                    Project.MSG_WARN);
        }

    }

它会默默地捕获异常,而不会进一步重新抛出它。