Ant 蚂蚁的警告是什么;运行时未设置引用*。“;什么意思?

Ant 蚂蚁的警告是什么;运行时未设置引用*。“;什么意思?,ant,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.

从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.
我很难理解这一点以及它为什么被输出,更不用说试图摆脱它了。任何帮助都将不胜感激

编辑:

类路径定义为:

<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" />

以这种方式引用(例如在中):

<classpath refid="project.classpath"/>

您可以如下所示在生成文件中设置类路径,以消除此警告。见参考资料


除非这是一个打字错误,否则看起来很麻烦。为了清晰起见,您确实应该重命名一个,即使它不是警告的原因。听起来project.classpath是在不同的目标中定义的,它们的调用顺序是错误的。您可能需要显示更多代码以获得更多帮助

<property name="project.classpath" refid="project.classpath" />

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


在Ant1.8中,这实际上是错误而不是警告。

我定义了“project.classpath”。你的意思是我应该在每个目标中引用它吗?你能展示设置/使用project.classpath的相关代码吗?看起来你可能有两个同名的参考文献,或者一个没有用过的参考文献。嗨,珍妮,我编辑了这个问题。谢谢。您在这里指的是具有相同值的“name”和“refid”吗?创建该属性是因为jvmarg显然不支持“refid”。如果我完全删除这一行,问题仍然存在。
<property name="project.classpath" refid="project.classpath" />