相关疑难解决方法(0)

如何解决"原因:找不到类org.apache.tools.ant.taskdefs.optional.junit.JUnitTask." 在运行"蚂蚁测试"?

我有一个名为test的目标,我想做一些测试.

我把这里的重要部分放在build.xml中.这包括:

<property name='lib.dir' value='lib' />

<path id='classpath'>
     <fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
Run Code Online (Sandbox Code Playgroud)

我在lib目录中放了junit.jarant-junit.jar(它是必须的吗?).

但是,如果我跑

ant test.

输出错误是:

test:

BUILD FAILED
/home/xiaohan/EclipseWorkSpace/AntTest/build.xml:82: Problem: failed to create task or type junit
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/home/xiaohan/.ant/lib
        -a directory added on the command line with the -lib argument

Do not …
Run Code Online (Sandbox Code Playgroud)

ant junit

21
推荐指数
3
解决办法
2万
查看次数

标签 统计

ant ×1

junit ×1