1

我克隆了一个新的 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 内运行的 ant 仍然抱怨。

任何蚂蚁/常春藤专家可以提供一些线索吗?

4

2 回答 2

1

在您的 STS 窗口中,转到“Windows”->“首选项”并确保所有 ant jar 文件都在此处列出,并确保这些 ant jar 的路径正确。 在此处输入图像描述

于 2013-10-03T18:29:51.590 回答
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 环境变量。

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

于 2013-05-04T17:27:54.757 回答