DMe*_*eng 7 java ant code-coverage jacoco
信息:java 版本:1.8.0_66 蚂蚁版本:1.9.6
我想做的事:
为在 AWS windows 2k12 服务器上运行的服务器代码提供代码覆盖率报告。
我做了什么:
结果:
出现错误无法读取执行数据文件 C:/path/to/exec/jacoco.exec
构建.xml:
<project name="Example" default="rebuild" xmlns:jacoco="antlib:org.jacoco.ant">
<description>
Example Ant build file that demonstrates how a JaCoCo coverage report
can be itegrated into an existing build in three simple steps.
</description>
<property name="result.dir" location="." />
<property name="result.classes.dir" location="${result.dir}/path/to/classes" />
<property name="result.report.dir" location="${result.dir}/report" />
<property name="result.exec.file" location="${result.dir}/jacoco.exec" />
<!-- Step 1: Import JaCoCo Ant tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="../jacocoant.jar" />
</taskdef>
<target name="clean">
<delete dir="${result.report.dir}" />
</target>
<target name="report">
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}" />
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Code Coverage Report">
<classfiles>
<fileset dir="${result.classes.dir}" >
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" />
</jacoco:report>
</target>
Run Code Online (Sandbox Code Playgroud)
我不确定问题是与 exec 文件有关(它可能已损坏)还是与我的整个设置有关。任何帮助识别和帮助解决问题的帮助表示赞赏!!!
谢谢!
我最近也遇到了同样的问题,我花了很长时间才解决这个问题。我希望我解决这个问题的方法能够帮助您或其他人。
ant -verbose report查看详细信息。我使用“ant -verbose report”并收到此消息:“java.io.IOException:不兼容版本1007”。 <dependency> <groupId>org.jacoco</groupId> <artifactId>org.jacoco.ant</artifactId> <version>0.7.4.201502262128</version> </dependency>
最终,报告成功生成。
| 归档时间: |
|
| 查看次数: |
12364 次 |
| 最近记录: |