2013-05-03 63 views
1

我克隆了一個新的回購庫,其中包含一個build.xml,該庫以彈簧工具套件(STS)在〜/ .ant/lib中安裝時找不到ivy.jar,並且命令行生成成功

<?xml version="1.0"?> 

<project name="mbark" basedir=".." xmlns:ivy="antlib:org.apache.ivy.ant"> 

,但此行,當我在STS運行,

<target name="build" description="Compile main source tree java files"> 
    <ivy:retrieve type="jar"/> 

始終未能在類似這樣的消息:

BUILD FAILED 
/home/myusername/Documents/workspace-sts-3.2.0.RELEASE/mbark/conf/build.xml:26: Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve 
Cause: The name is undefined. 
Action: Check the spelling. 
Action: Check that any custom tasks/types have been declared. 
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 
No types or tasks have been defined in this namespace yet 

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of: 
     -/home/myusername/springsource/sts-3.2.0.RELEASE/plugins/org.apache.ant_1.8.3.v201301120609/lib 
     -/home/myusername/.ant/lib 
     -a directory added on the command line with the -lib argument 

我可以瀏覽到我家的螞蟻文件夾並找到ivy.jar;我可以從命令行構建;我也在項目中指定了ANT_HOME |屬性|資源|鏈接的資源|路徑變量(雖然我不認爲這個設置會有幫助,但我做到了),但STS內部的運行螞蟻仍然抱怨。

任何螞蟻/常春藤專家都可以提供一些線索嗎?

回答

0

您是否嘗試將常春藤罐放在錯誤消息中列出的以下位置之一?

行動:檢查實施庫中的一個存在:

-/home/myusername/springsource/sts-3.2.0.RELEASE/plugins/org.apache.ant_1.8.3.v201301120609/lib 
    -/home/myusername/.ant/lib 

你的問題是,Eclipse有它的管理ANT自己的機制。它將忽略ANT_HOME環境變量。

有關詳細信息(以及可能的變通)請參見下面的答案:

+0

我確實安裝了ivy.jar。使用ant和build.xml命令行構建完美。 – xiaochuanQ 2013-05-06 14:59:29

1

從您的STS窗口,進入到 「窗口」 - > 「首選項」,並確保所有的ant jar文件都在那裏列出,並確保這些螞蟻罐子的路徑是正確的。 enter image description here

相關問題