蚂蚁警告"Reference * has not been set at runtime..."是什么意思?



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

它被这样引用(例如in):

<classpath refid="project.classpath"/>

我以前也遇到过同样的问题。只要确保"项目"。"类路径"定义在构建文件的开头,在其他目标引用它之前。还有你的"libs"。Ant " path应该在"project.classpath"之前定义。

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

您可以像下面这样在构建文件中设置classpath,以消除此警告。见参考。http://ant.apache.org/manual/using.html

<project ... >
  <path id="project.class.path">
    <pathelement location="lib/"/>
    <pathelement path="${java.class.path}/"/>
    <pathelement path="${additional.path}"/>
  </path>
  <target ... >
    <rmic ...>
      <classpath refid="project.class.path"/>
    </rmic>
  </target>
  <target ... >
    <javac ...>
      <classpath refid="project.class.path"/>
    </javac>
  </target>
</project>

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

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

最新更新