当我使用Java IDE构建具有JUnit测试的项目(例如NetBeans)时,它们编译得很好,但是当我尝试在IDE之外使用ant来运行构建脚本时,我得到错误"package org.junit不存在".
DJ.*_*DJ. 12
您应该将junit.jar添加到ant文件的类路径定义中.
有很多方法可以做到,一个例子是:
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="your.classpath.refid" />
<fileset dir="${junit.dir}">
<include name="**/junit.jar" />
</fileset>
</classpath>
...
</junit>
Run Code Online (Sandbox Code Playgroud)
有关设置类路径的详细信息,请参见Ant手册.
归档时间: |
|
查看次数: |
46693 次 |
最近记录: |