什么Ant警告"引用*尚未在运行时设置......"是什么意思?

vah*_*idg 5 ant

从Ant 1.6.5升级到1.7.1后,我的构建输出开始于:

Warning: Reference project.classpath has not been set at runtime, but was found during
build file parsing, attempting to resolve. Future versions of Ant may support
 referencing ids defined in non-executed targets.
Warning: Reference project.test.classpath has not been set at runtime, but was found during
build file parsing, attempting to resolve. Future versions of Ant may support
 referencing ids defined in non-executed targets.
Run Code Online (Sandbox Code Playgroud)

我有理解这个问题以及输出的原因,更不用说试图摆脱它了.任何帮助,将不胜感激!

编辑:

类路径定义如下:

<path id="project.classpath">
        <pathelement path="./${build.dir}" />
        <path refid="libs.ant" />
        <fileset dir="${lib.dir}/dependencies/bar" includes="compile/*.jar" />
        <fileset dir="${lib.dir}/dependencies/foo" includes="provided/*.jar" />
</path>

<!-- The classpath for compiling this projects' tests -->
<path id="project.test.classpath">
        <path refid="project.classpath" />
        <fileset dir="${lib.dir}/dependencies/bar" includes="test/*.jar" />
        <fileset dir="${lib.dir}/dependencies/foo" includes="test/*.jar" />
</path>

<property name="project.classpath" refid="project.classpath" />
Run Code Online (Sandbox Code Playgroud)

它以这种方式引用(例如in):

<classpath refid="project.classpath"/>
Run Code Online (Sandbox Code Playgroud)

Jam*_*s H 3

我之前也遇到过同样的问题。只需确保在其他目标引用它之前,在构建文件的开头定义“project.classpath”即可。另外,您的“libs.ant”路径应该在“project.classpath”之前定义。

在 Ant 1.8 中,这实际上是错误而不是警告。