【发布时间】:2018-02-12 17:59:22
【问题描述】:
目前,我正在从 Ant 运行 Junit。
我的环境变量 JAVA_HOME 设置为 /path-to-jdk6,但我希望 JUnit 测试使用 /path-to-jdk8 运行。
如何设置?
这是我的 Ant 目标:
<target name="junit" depends="compile">
<junit printsummary="yes"
haltonfailure="no">
<classpath> <path refid="sample-classpath" /> </classpath>
<formatter type="plain" usefile="false" />
<batchtest todir="${junit.report.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
【问题讨论】:
-
您是否有不关闭 target 标记 的原因? 目标>。您真的在问如何设置环境变量吗?在这种情况下,您使用的操作系统会很有用。
-
@JonGoodwin 格式问题。添加了关闭目标。我在这里使用linux。而蚂蚁版本是1.8.1
标签: junit ant junit4 java-home