Spring-Tool-Suite(STS)在〜/ .ant / lib中安装时找不到ivy.jar,命令行构建成功

时间:2013-05-03 21:52:32

标签: ant ivy

我克隆了一个新的repo,它有一个build.xml,以

开头
<?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

我可以浏览我的ant主文件夹并找到ivy.jar;我可以从命令行构建;我还在项目中指定了ANT_HOME属性|资源|链接资源|路径变量(虽然我不认为这个设置会有所帮助,但我确实这样做了),但STS内部的蚂蚁仍然抱怨。

任何蚂蚁/常春藤专家能给出一些线索吗?

2 个答案:

答案 0 :(得分:1)

从您的STS窗口转到“Windows” - &gt; “首选项”并确保列出所有ant jar文件,并确保这些ant jar的路径是正确的。 enter image description here

答案 1 :(得分: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环境变量。

有关详细信息(以及可能的解决方法),请参阅以下答案: