本文介绍了在运行Ant生成给人"包org.junit不存在"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用Java IDE来构建具有JUnit测试,他们编制很好,但是当我尝试使用IDE的蚂蚁外运行构建脚本,我得到的错误包组织项目(如NetBeans的)。 JUnit的不存在。
When I use a Java IDE to build projects (e.g. NetBeans) that have JUnit tests, they compile fine, but when I try to use ant outside of the IDE to run the build script, I get the error "package org.junit does not exist".
推荐答案
您应该添加您的junit.jar到类路径定义在你的Ant文件。
You should add your junit.jar into the classpath definition in your ant file.
有许多办法做到这一点,一个例子是:
There are many way to do it, one example is:
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="your.classpath.refid" />
<fileset dir="${junit.dir}">
<include name="**/junit.jar" />
</fileset>
</classpath>
...
</junit>
有关设置类路径的详细信息。
这篇关于在运行Ant生成给人&QUOT;包org.junit不存在&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!