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

ant解压任务:如果解压失败,为什么它不会失败?,ant,groovy,unzip,Ant,Groovy,Unzip,我在自定义编写的安装程序中使用groovy AntBuilder,例如解压缩安装包。 有一件事我搞不清楚,那就是如何检测解压任务是否失败,例如。 我有以下代码: ... AntBuilder antBuilder = new AntBuilder() antBuilder.mkdir(dir:installationPath) antBuilder.unzip(src:zipFileName, dest:installationPath,overwrite:"yes") ... 如果目标路径(

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

...
AntBuilder antBuilder = new AntBuilder()
antBuilder.mkdir(dir:installationPath)
antBuilder.unzip(src:zipFileName, dest:installationPath,overwrite:"yes")
...
如果目标路径(“installationPath”)受写保护,则解压会报告错误(“无法展开…”),但任务本身不会失败。解压也没有“failOnError”属性


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

似乎无法捕获异常

根据ant的源代码

    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);
        }

    }
它默默地捕获异常,而不进一步抛出它