我有一些導入另一個的ant文件。具體來說build.xml
進口一個project_default.xml
。當我嘗試做一個生成我得到以下錯誤:找到導致螞蟻失敗的原因
Buildfile: C:\myproject\build.xml [taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
BUILD FAILED C:\myproject\build.xml:14: The following error occurred while executing this line: C:\myproject\project_default.xml:17: Problem: failed to create task or type if Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any /declarations have taken place.
行報告17如下:
<if>
<contains string="${env.PROJECT_SELECTION}" substring="env.PROJECT_SELECTION" />
我還添加在build.xml
如下:
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="D:\UserData\ant-contrib-0.6-bin\lib\ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
但得到了同樣的錯誤。想知道這裏有什麼問題嗎?
複製粘貼你的代碼,仍然會得到同樣的錯誤.'不能從資源淨/ sf/antcontrib/antcontrib.properties中加載定義。' – Jim
嗨,你的build.xml文件中的任務是在執行taskdef?是真正位於「D:\ UserData \ ant-contrib-0.6-bin \ lib \ ant-contrib-0.6.jar」的jar文件嗎?而不是明確地定義它,你也可以將它移動到你的ant安裝目錄下的lib目錄中......這樣你就不需要 ... –
Naytzyrhc