Java 生成失败D:\opt\trunk\BUILD.xml:117:无法为创建类型为的任务或类型

Java 生成失败D:\opt\trunk\BUILD.xml:117:无法为创建类型为的任务或类型,java,xml,ant,Java,Xml,Ant,我已经将antcontrib.03.jar添加到ANT_HOME/lib和单独的位置d:\lib中,它仍然会给我这个错误。有人能帮我吗。谢谢 构建属性 编译文件 正在复制文件@{单个文件} 输出误差 D:\opt\trunk>ant部署根目录 Buildfile:build.xml [taskdef]无法从资源库/net/sf/antcontrib/antcontrib.properties加载定义。找不到。 初始化: [回声]今天日期和时间:2012年5月2日,英国夏令时下午12:16:2

我已经将antcontrib.03.jar添加到ANT_HOME/lib和单独的位置d:\lib中,它仍然会给我这个错误。有人能帮我吗。谢谢

构建属性 编译文件

正在复制文件@{单个文件}
输出误差
D:\opt\trunk>ant部署根目录
Buildfile:build.xml
[taskdef]无法从资源库/net/sf/antcontrib/antcontrib.properties加载定义。找不到。
初始化:
[回声]今天日期和时间:2012年5月2日,英国夏令时下午12:16:28
准备:
部署根目录:
构建失败
D:\opt\trunk\build.xml:117:无法为创建类型为的任务或类型。
Ant找不到该任务所依赖的任务或类。
这是常见的,有很多原因;照常
解决方案是阅读手册页面,然后下载并
安装所需的JAR文件,或修复生成文件:
-你拼错了“for”。
修正:检查你的拼写。
-该任务需要一个外部JAR文件来执行
并且在类路径中的正确位置找不到它。
修复:检查文档中的依赖项。
修复:声明任务。
-该任务是一个Ant可选任务以及JAR文件和/或库
在创建时未找到实现该功能的方法
您自己从Ant源代码构建了Ant安装。
修复方法:在ANT_HOME/lib中查找对应于
任务,并确保它不仅仅包含META-INF/MANIFEST.MF。
如果它只包含清单,那么使用所需的
存在于${ant.home}/lib/optional/中的库,或者,
从apache.org下载预构建版本
-生成文件是为更高版本的Ant编写的
修复:升级至至少最新版本的Ant
-该任务不是Ant核心任务或可选任务
并且需要使用声明。
-您正在尝试使用使用定义的任务
还是拼错了
在使用点定义它
记住,要使JAR文件对实现的Ant任务可见
在ANT_HOME/lib中,文件必须位于同一目录中或位于
类路径
请不要提交有关此问题的错误报告,也不要向
Ant邮件列表,直到所有这些原因都被探究,
因为这不是一只蚂蚁虫。

文件
D:/opt/trunk/lib/net/sf/antcontrib/antcontrib.properties
在构建文件中被引用,但不存在(或当前用户无法访问)。确保它存在并且允许当前用户阅读。

使用:

<taskdef resource="net/sf/antcontrib/antlib.xml">
  <classpath>
    <pathelement location="d:/lib/ant-contrib-0.3.jar"/>
  </classpath>
</taskdef>

相反。

antcontrib.properties文件仅包含1.6之前的ant版本的taskdefs,其中未包含

我按照此处给出的说明进行了操作:我自己已经解决了这个问题。ant.contrib-0.3.jar与ant版本1.6不兼容,此jar文件仅与ant版本1.5或更低版本兼容。解决方案是使用ant-contrib-1.0b3.jar文件。谢谢你的建议。此外,容器任务应该在循环内部而不是外部声明。
应该在循环内部
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
  <classpath>
    <pathelement location="d:/lib/ant-contrib-0.3.jar"/>
  </classpath>
</taskdef>

<!-- copy new ROOT.war file -->
<target name="deploy-root" description="Copy new root.war from pCMS back-end to front-end" depends="prepare">
        <sequential>
            <for list="${root.war.file}" param="single-file">
                <echo> Copying File @{single-file} </echo>
                <copy file="@{single-file}" todir="${path.to.tomcat.webapps}" overwrite="true" />
            </for>  
        </sequential>
</target>
D:\opt\trunk>ant deploy-root
Buildfile: build.xml
  [taskdef] Could not load definitions from resource lib/net/sf/antcontrib/antcontrib.properties. It could not be found.

init:
     [echo] TODAYS DATE AND TIME: 2 May 2012, 12:16:28 PM, BST

prepare:

deploy-root:

BUILD FAILED
D:\opt\trunk\build.xml:117: Could not create task or type of type: for.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
 - You have misspelt 'for'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
     and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and the JAR file and/or libraries
     implementing the functionality were not found at the time you
     yourself built your installation of Ant from the Ant sources.
   Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
     task and make sure it contains more than merely a META-INF/MANIFEST.MF.
     If all it contains is the manifest, then rebuild Ant with the needed
     libraries present in ${ant.home}/lib/optional/ , or alternatively,
     download a pre-built release version from apache.org
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task
     and needs to be declared using <taskdef>.
 - You are attempting to use a task defined using
    <presetdef> or <macrodef> but have spelt wrong or not
   defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
<taskdef resource="net/sf/antcontrib/antlib.xml">
  <classpath>
    <pathelement location="d:/lib/ant-contrib-0.3.jar"/>
  </classpath>
</taskdef>