ant中的任务类路径:Java

时间:2013-02-18 18:55:02

标签: java ant classpath task

我在我的蚂蚁中执行此操作时出错,我不明白为什么ant无法识别任务类路径:

<?xml version="1.0"?>

<project default="task">

<target name="task">
    <classpath>
        <pathelement path="." />
    </classpath>
</target>

</project>

我收到错误消息:

task:

BUILD FAILED
C:\way\build.xml:6: Problem: failed to create task or type classpath
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.

有人知道错误的来源吗?

1 个答案:

答案 0 :(得分:0)

Ant中没有classpath任务(即使某些任务 执行 允许您指定类路径。您 可以< / em> 使用path任务测试基本的Ant构建,作为替代方案:

<?xml version="1.0"?>

<project default="task">

<target name="task">
    <path id  = "class.dirs.path">
        <dirset dir  = "${build}" includes = "class.dir.list" />
    </path>
</target>
</project>