您的位置:首页 > 其它

ant学习笔记(四)

2008-01-08 13:01 453 查看
昨天在运行ant进行junit测试的时候不停的报错: [junit] java.io.FileNotFoundException: junitvmwatcher***.properties (系统找不到指定的文件)然后怎么都查不出错误,今天早上也同样没有解决。而且只有<batchtest>才会出问题,<test>是OK的。

下面的是我的ant脚本,原来没有红色的一行。

<!-- run junit -->
<target name="junit" depends="compilejunit">
<junit printsummary="yes" haltonfailure="yes" >
<classpath>
<fileset dir="${plugin.depend}">
<include name="**/*.jar"/>
<exclude name="**/ant*.jar"/>
</fileset>
<pathelement location="${junit.bin}"/>
</classpath>

<test name="${release.checher}"
haltonfailure="yes"
todir="${junit.report.dir}"
>
<formatter type="xml"/>
</test>

<batchtest fork="yes"
todir="${junit.report.dir}"
haltonfailure="yes"
>
<fileset dir="${junit.src}">
<include name="**/*Test*.java"/>
</fileset>
<formatter type="xml"/>
</batchtest>

</junit>
</target>

直到后来google,终于发现了问题所在:虽然系统环境变量中设置的是1.7.0的ant,但是在load需要的jar的时候load了eclipse自带的1.6.2的ant,而1.7.0是不会有这种问题的。<test>用的是现有的环境变量设置,所以不会有问题,而<batchtest>是fork出来,使用了<classpath>中的设置的。

发现了问题,解决起来自然很快,exclude旧版本的ant就行了~~如上红色:)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: