1

<gunzip>任务的文档说它有一个即时版本。

在我的情况下,这会导致 NullPointerException:

>ant download
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Buildfile: ...\build.xml

download:

BUILD FAILED
...\build.xml:10: java.lang.NullPointerException
        at org.apache.tools.ant.taskdefs.Unpack.createDestFile(Unpack.java:144)
        at org.apache.tools.ant.taskdefs.Unpack.validate(Unpack.java:139)
        at org.apache.tools.ant.taskdefs.Unpack.execute(Unpack.java:164)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:853)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Total time: 0 seconds

build.xml如下:

<project name="MnistDigitsCorpus" basedir=".">
    <description>
        Скачивает файлы с хоста MNIST
    </description>

    <target name="download">
        <tstamp/>
        <gunzip dest=".">
            <url url="http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz"/>
            <!--<url url="http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz"/>
            <url url="http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz"/>
            <url url="http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz"/>-->
        </gunzip>

   ...
4

1 回答 1

3

这是 Ant <= 1.9.6 中的一个(目前未知)错误,在提取非文件系统资源时触发。起初我认为只有当 dest 指向一个目录时才会发生这种情况,并且您可以通过指定未压缩的目标文件名来解决它 - 但我的测试表明这只会在不同的地方触发 NullPointerException。

我已经用 git commit 7f0eeea[1](和 bunzip 用 3c2ed13)修复了 Ant 主分支中的错误,但请在https://bz.apache.org/bugzilla/提交错误报告,以便我们正确跟踪它。

[1] https://github.com/apache/ant/commit/7f0eeea180a809355885bfcb6dbb65d5da307849

于 2015-09-10T19:06:34.773 回答