[英]Jacoco ant task - no jacoco.exec output
I configured my Ant task as我将我的 Ant 任务配置为
<target name="test" depends="init">
<jacoco:coverage destfile="target/jacoco.exec">
<junit printsummary="yes" haltonfailure="yes" fork="yes" forkmode="once">
<classpath refid="my_project.path"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="false" todir="target/test-reports">
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</target>
Which produces the expected junit result.这会产生预期的junit 结果。 However, the
target/jacoco.exec
is never created.但是,永远不会创建
target/jacoco.exec
。 I do not have any error during the ant test report
task execution.我在
ant test report
任务执行过程中没有任何错误。
test: [jacoco:coverage] Enhancing junit with coverage
测试:[jacoco:coverage] 通过覆盖增强 junit
... [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,009 sec
report: [jacoco:report] Loading execution data file /home/usr/Workspaces/my_project/target/jacoco.exec
报告:[jacoco:report] 正在加载执行数据文件 /home/usr/Workspaces/my_project/target/jacoco.exec
BUILD FAILED /home/usr/Workspaces/my_project/build.xml:73: Unable to read execution data file /home/usr/Workspaces/my_project/target/jacoco.exec
构建失败 /home/usr/Workspaces/my_project/build.xml:73: 无法读取执行数据文件 /home/usr/Workspaces/my_project/target/jacoco.exec
Total time: 14 seconds
总时间:14秒
Seems like I am missing something, unable to see what exactly.好像我错过了一些东西,无法看到究竟是什么。
I found the cause.我找到了原因。 It is stupid but there was no logging to indicate the error:
这很愚蠢,但没有记录来指示错误:
batchtest fork="true" todir="target/test-reports"
batchtest fork="true" todir="target/test-reports"
The fork parameter was set to false in the batchtest.在批处理测试中 fork 参数设置为 false。 Setting it back to "true" produces the expected jacoco.exec .
将其设置回“true”会产生预期的jacoco.exec 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.