我是JaCoCo的新手,并试图弄清楚为什么我生成的html报告与我的来源没有关联。JaCoCo报告看起来正确,但无法查看来源
覆盖范围数字看起来是正确的,我可以浏览到每个类然后每种方法,但我看不到源。我已经在sourcefiles标签内尝试过很多不同的东西,但没有任何工作。其他人遇到过这个问题吗?这里是我的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>
...
谢谢。这是我在文件集中指定的目录的问题。将“fw”更改为“。”解决了我的问题。 – Jeff
谢谢,这个答案帮助了我。最初我有'dir =“src”'并且与作者有同样的问题,但是当它改为'dir =“src/main/java”'时,我得到了我的源代码覆盖。 –