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就行了~~如上红色:)
下面的是我的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就行了~~如上红色:)
相关文章推荐
- Ant学习笔记--入门
- ant 学习笔记
- Ant学习笔记(Ant入门)
- Ant打包编译部署工具学习笔记
- 学习笔记——Ant
- Ant 学习笔记(二)
- Ant学习笔记1
- Ant 学习笔记(四)
- Ant学习笔记——自己构建Ant编译环境
- ANT学习笔记
- Ant学习笔记
- 雾山的Robotium学习笔记---Ant 构建脚本
- Ant 学习笔记 (一)
- Ant学习笔记(一)
- Ant打包编译部署工具学习笔记
- ant学习笔记2
- 【点击模型学习笔记】Ad centric model discovery for redicting ads' click through rate_ANT2013_Tencent
- Ant学习笔记(2) 在Eclipse中使用Ant
- Ant学习笔记[部分]
- 黑马程序员 ---------------------- ANT 学习笔记