搜档网
当前位置:搜档网 › eclipse下将juit.jar加入到ant_home

eclipse下将juit.jar加入到ant_home

eclipse下将juit.jar加入到ant_home
eclipse下将juit.jar加入到ant_home

eclipse下将juit.jar加入到ant_home

为了在ant中使用junit实现测试功能,必须往 $ant_home/lib中加入

junit.jar,你可能会发现在 $ANT_HOME/lib目录已经有一个 ant-junit.jar 文件了. 这个 jar 包不是 JUnit 类库, 而是 Ant 的 junit task 实现,在执行Ant junit task时会使用你新增的这个junit.jar 文件。

我使用的开发平台是eclipse(自带ant),ant_home其实就是eclipse目录下的plugins\org.apache.ant_1.6 下,我将junit.jar放在该目录下,

然后在eclipse中运行ant的junit测试,很遗憾没有运行成功。我在网上找了些解决方案,比如说设置ant_home环境变量,然后将ant_home下的bin目录加入到path里,但是在eclipse里运行还是不能成功。

我想eclipse里应该有设置ant_home的地方,经过几次尝试,终于找到了。点击window-->preferences-->ant-->rumtime, 会看到下面的一个视图

选中classpath,就可以看到 Ant Home Entries这样一个条目,选中它,然后点击右边的"Add External JARS"将junit引入,就可以了。

相关主题