2011-04-21 73 views
5

由於從螞蟻1.6.5升級到1.7.1,我的體型輸出開始與:什麼是Ant運行警告「參考*尚未在運行時設置...」是什麼意思?

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

你可以顯示相關的代碼,設置/使用project.classpath?它看起來像你可能有兩個同名的引用或一個未使用的引用。 – 2011-04-22 00:24:17

+0

嗨,珍妮,我編輯了這個問題。謝謝。 – vahidg 2011-04-22 17:12:03

回答

3

我以前有同樣的問題。只要確保在其他目標引用它之前在構建文件的開頭定義了「project.classpath」。另外你的「libs.ant」路徑應該在「project.classpath」之前定義。

在Ant 1.8中,這實際上是錯誤而不是警告。

+0

這就是它,謝謝! – vahidg 2011-07-14 07:43:58

0

您可以在構建文件如下設置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> 
+0

我定義了'project.classpath'。你的意思是我應該在每個目標中引用它嗎? – vahidg 2011-04-21 15:07:20

0

除非這是一個錯字,它看起來像麻煩。即使它不是警告的原因,您也應該重新命名。它仍然聽起來像project.classpath是在不同的目標中定義的,並且它們以錯誤的順序被調用。您可能需要顯示更多代碼才能獲得更多幫助。

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

你指的是'name'和'refid'在這裏有相同的值嗎?該屬性是因爲顯然jvmarg不支持'refid'。如果我完全刪除這條線,問題仍然存在。 – vahidg 2011-04-27 10:55:55