【问题标题】:Cobertura - classes are not instrumented anymoreCobertura - 类不再被检测
【发布时间】:2017-05-06 14:24:17
【问题描述】:

我在我的 Jenkins-build 中使用gradle-cobertura-plugin。昨天我修复了这个插件中的一个问题,它覆盖了配置的辅助类路径。此问题阻止了某些类出现在覆盖率报告中。修复很简单:

我更改了以下内容:

auxiliaryClasspath = project.files("${project.buildDir.path}/intermediates/classes/${classesDir}")

if (auxiliaryClasspath != null) {
        auxiliaryClasspath += project.files("${project.buildDir.path}/intermediates/classes/${classesDir}")
} else {
        auxiliaryClasspath = project.files("${project.buildDir.path}/intermediates/classes/${classesDir}")
}

使用gradle cobertura 在本地运行构建一切正常,并且缺少的类显示在报告中。 在 Jenkins 上安装插件的补丁版本后,Jenkins 的覆盖率变为零。

环顾所发生的事情,我发现instrumented_classes-文件夹中的类不再被检测!回滚所有内容(build.gradle、卸载我的插件、清除 gradle 缓存等),行为保持不变。由于它在本地工作,我想知道是什么导致了这个问题。

我认为有一些严重错误可能已被记录并被默默忽略,但我不知道在哪里查找此信息。 Jenkins 日志很干净,所以我认为为负责检测的代码添加一个记录器可能会有所帮助。不幸的是,我不知道要启用什么记录器。 org.sourceforge.cobertura 没有输出任何东西。

所以我的问题是:有没有其他人看到这种行为并可能提出如何解决这个问题的线索?

【问题讨论】:

    标签: java jenkins gradle cobertura


    【解决方案1】:

    好的,我想通了。经过多次试验和错误,我发现coverageExcludes-property 的一点变化是罪魁祸首。在多次更改后,类再次被检测。有趣的是它确实在本地工作,但不是在詹金斯。如果再次发生,我想我必须深入研究一下。

    现在我很高兴它有效。 :-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-16
      • 1970-01-01
      • 1970-01-01
      • 2012-10-16
      • 1970-01-01
      • 2011-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多