What does it mean that the Ant warning "Reference * is not set at runtime ..." means?

Starting from the upgrade from Ant 1.6.5 to 1.7.1, my build result starts with:

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.

I have problems understanding this and why it is being displayed, not to mention trying to get rid of it. Any help would be appreciated!

EDIT:

The path to the classes is defined:

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

It is referenced (e.g., in) as follows:

<classpath refid="project.classpath"/>
+5
source share
3 answers

I had the same problem. Just make sure "project.classpath" is defined at the beginning of the build file before other targets contact it. Also your path "libs.ant" should be defined before "project.classpath".

In Ant 1.8, this will be a bug rather than a warning.

+3

, . . . 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>
0

If it's not a typo, it seems like a nuisance. You really should rename it for clarity, even if that is not the reason for the warning. It still sounds like project.classpath is defined for different purposes, and they are called in the wrong order. You may need to show more code for more help.

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

All Articles