我是 JaCoCo 的新手,并试图找出为什么我生成的 html 报告未与我的源链接。
覆盖率数字看起来正确,我可以浏览到每个类,然后浏览到每个方法,但我看不到源代码。我在源文件标签内尝试了许多不同的东西,但没有任何效果。其他人遇到过这个问题吗?这是我的 ant 脚本的片段:
...
<test name="test.fw.UITestSuite" todir="${logdir}"/>
</junit>
</jacoco:coverage>
<fail if="TestFailed" status="1" message="UI junit test failure detected"/>
<echo message="${src}"/>
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
</executiondata>
<structure name="UI">
<classfiles>
<fileset dir="${build}/fw"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="fw" includes="**./*.java"/>
</sourcefiles>
</structure>
<html destdir="report"/>
</jacoco:report>
</target>
...
最佳答案
你的fileset
定义看起来很奇怪。
包含必须是(第一个 . 放错了位置):
includes="**/*.java
尝试简单地将其指向您的 src 目录的根目录(不需要包含)
<fileset dir="fw" />
但是 fw 必须是源的根目录,即它包含如下包文件夹:
src
-org
-module
-MyClass1.java
-MyClass2.java
关于ant - JaCoCo 报告看起来正确,但无法查看源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10914320/