Apache ant不识别';对于';任务/宏,尽管我通过taskdef添加了ant contrib
在进行ant构建时,我得到以下信息:Apache ant不识别';对于';任务/宏,尽管我通过taskdef添加了ant contrib,ant,build,Ant,Build,在进行ant构建时,我得到以下信息: 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>/<ma
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\Build.xml:247:问题:无法创建任务或类型
对于
原因:名称未定义。
措施:检查拼写。
操作:检查是否已声明任何自定义任务/类型。
措施:检查是否发生了任何/声明。
build.xml第247行是
已经定义了
,但它不起作用。然后我特别添加了以下内容,但它仍然不起作用
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${env.ANT_HOME}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
我有ant-contrib-1.0b3.jar在C:\Softwares\apache-ant-1.8.4\lib目录下
这里缺少什么?如果您将AntContrib jar放在
$ANT_HOME
/lib目录中,您真正需要做的就是:
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
Ant需要意识到依赖性。以下是David W答案的更简洁版本。将以下等效项添加到ant项目中:
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="relative/path/to/ant-contrib-1.0b3.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="relative/path/to/ant-contrib-1.0b3.jar"/>
您也可以使用ant-contrib ant-contrib 20020829将ant-contrib添加为Maven依赖项,其他人在运行Maven时将获得jar。将ant-contrib jar放入项目的全部目的是简化构建。假设我定义了一个标准开发环境:您需要VCS、Java和Ant。检查此项目的人不必做任何事情就可以让它工作,即使它需要ant contrib。它是独立的。我签出并构建。有了Maven,我现在必须安装Maven,然后在运行Ant之前运行Maven。
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${basedir}/ant-contrib.dir"/>
</classpath>
</taskdef>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="relative/path/to/ant-contrib-1.0b3.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="relative/path/to/ant-contrib-1.0b3.jar"/>