我克隆了一个新的存储库,它有一个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仍然报错。
有没有蚂蚁/常春藤专家能给点提示?
发布于 2013-10-04 02:29:52
在您的STS窗口中,转到"Windows"-> "Preferences“,确保在那里列出了所有ant jar文件,并确保这些ant jar文件的路径是正确的。

发布于 2013-05-05 01:27:55
您是否尝试将常春藤罐子放在错误消息中列出的以下位置之一?
操作:检查实现库是否存在于以下某个库中:
-/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环境变量。
有关更多详细信息(以及可能的解决方法),请参阅以下答案:
https://stackoverflow.com/questions/16368092
复制相似问题