gpt4 book ai didi

kotlin - 尝试将 Jacoco 代码覆盖率导入 SonarQube 时出现问题 : Cannot import coverage information for file, 覆盖率数据无效

转载 作者:行者123 更新时间:2023-12-01 00:12:56 25 4
gpt4 key购买 nike

我在尝试将 Jacoco 代码覆盖率导入 SonarQube 时遇到了一些问题。

我正在使用带有 Jacoco 的 SonarQube 来导入测试覆盖率结果 ( https://docs.sonarqube.org/display/PLUG/Java+Unit+Tests+and+Coverage+Results+Import )。一切都运行良好,直到我有了 forEach 阻止某些方法。

ERROR: Cannot import coverage information for file, coverage data is invalid. 
java.lang.IllegalStateException: Line 29 is out of range in the file (lines: 28)

如果我删除 forEach 文件然后正确生成测试覆盖率,但使用 forEach 我得到 0% 的覆盖率。

仅当我将它与 sonarqube 集成时才会发生这种情况,如果我在本地运行 jacoco,它可以完美运行。

我们使用 SonarQube Scanner 3.3.0.1492,SonarQube 服务器 7.5.0。

最佳答案

按关键字在 Google 中搜索 sonarqube kotlin jacoco

is out of range in the file


显示以下页面 https://community.sonarsource.com/t/sonar-kotlin-coverage-fails-due-to-line-is-out-of-range-errors/3201/18 ,其中指出该问题已在 JaCoCo 版本 0.8.3 中得到解决其中包含页面链接 https://github.com/jacoco/jacoco/issues/763 ,它反过来包含对问题的非常有表现力的解释,包括对它为什么影响 SonarQube 的解释。
所以请确保您使用 JaCoCo 版本 0.8.3甚至更好的最新版本,即 0.8.7截至 2021 年 9 月 8 日。

关于kotlin - 尝试将 Jacoco 代码覆盖率导入 SonarQube 时出现问题 : Cannot import coverage information for file, 覆盖率数据无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56126285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com