Apache Ant的不承认'的'任务/微距,虽然我已经通过添加的taskdef蚂蚁的contrib [英] Apache ant does not recognize 'for' task/macro, although I have added ant-contrib via taskdef
问题描述
我收到以下,而这样做Ant构建:
I am getting following while doing ant build:
Build\build.xml:247: Problem: failed to create task or type
for
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.
的build.xml行247 &lt;用于参数=文件&GT;
已经定义的&LT;的taskdef资源=网/ SF / antcontrib / antcontrib.properties/&GT;
,它没有工作。然后,我特意加入以下但它仍然没有工作。
Already defined <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
, it didn't work. Then I specifically added following but it is still not working.
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${env.ANT_HOME}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
我的蚂蚁的contrib-1.0b3.jar 在 C:\\软件\\ Apache的ANT-1.8.4 \\ lib中目录。
缺少什么吗?
I have ant-contrib-1.0b3.jar at C:\Softwares\apache-ant-1.8.4\lib directory.
What is missing here?
推荐答案
如果您放置在 $ ANT_HOME
/ lib目录AntContrib罐子,你真正需要做的是这样的:
If you placed the AntContrib jar in $ANT_HOME
/lib directory, all you really need to do is this:
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
实际上使用&lt;用于/&GT;
任务,你需要做的是:
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
请注意,你必须使用 antlib.xml
,而不是 antcontrib.properties
。 仔细阅读安装方向。这很容易错过。
Note you have to use antlib.xml
and not antcontrib.properties
. Read the Installation directions very carefully. It's easy to miss.
如果您在团体项目这样做,我建议你把你的蚂蚁contrib.jar在项目中。然后将它们添加到您的项目在你的版本控制系统。这样一来,其他开发人员可以使用你的构建与蚂蚁的contrib任务,而无需下载蚂蚁contrib请罐,并在其$ ANT_HOME目录中安装它自己。
If you are doing this in a group project, I recommend that you put your ant-contrib.jar in your project. THen add them to your project in your version control system. That way, other developers can use your build with the ant-contrib tasks without downloading the ant-contrib jar and installing it in their $ANT_HOME directory themselves.
让我们说你创建一个名为蚂蚁contrib.dir
,并把在你的项目的根目录,然后把蚂蚁contrib请罐的文件夹中。只要把这个项目中的:
Let's say you create a directory called ant-contrib.dir
and put that in the root of your project, then put the ant-contrib jar in that folder. Just put this in your project:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${basedir}/ant-contrib.dir"/>
</classpath>
</taskdef>
这篇关于Apache Ant的不承认'的'任务/微距,虽然我已经通过添加的taskdef蚂蚁的contrib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!