简体   繁体   English

JUnit5 的 Jacoco 插件失败,没有覆盖

[英]Jacoco plugin fails for JUnit5 with no coverage

Here at unit-api we recently migrated from JUnit4 to JUnit5.unit-api,我们最近从 JUnit4 迁移到 JUnit5。 Unfortunately, there are some complications, though.不幸的是,有一些并发症。 To be more specific, once we migrated, the build completes successfully for OSX, but fails for Windows OS.更具体地说,一旦我们迁移,构建在 OSX 上成功完成,但在 Windows 操作系统上失败。

Our setup is:我们的设置是:

  • jacoco-maven-plugin at v.0.8.2 jacoco-maven-plugin
  • JUnit5 JUnit5

You can read more about the specific issue here .您可以在此处阅读有关特定问题的更多信息。

Any ideas?有任何想法吗?

After some testing and reading I think the issue is related to how Jacoco deals with multi-release-JARs or builds.经过一些测试和阅读,我认为这个问题与 Jacoco 如何处理多版本 JAR 或构建有关。

I have added following modification to your POM.xml:我在您的 POM.xml 中添加了以下修改:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>${jacoco.plugin.version}</version>
    <configuration>
      <excludes>
        <exclude>META-INF/**</exclude>
      </excludes>
    </configuration>
</plugin>

For simplicity here I did not include all the <execution> settings.为简单起见,我没有包括所有<execution>设置。

Running a build then using mvn clean verify site results in properly populated reports in target\\site\\jacoco .运行构建然后使用mvn clean verify site结果在target\\site\\jacoco中生成正确填充的报告。 The HTML, XML and CSV reports then seem to be complete, no empty files anymore. HTML、XML 和 CSV 报告似乎是完整的,不再有空文件。

There are also some related StackOverflow questions and an issue at Jacoco Github:还有一些相关的 StackOverflow 问题和 Jacoco Github 上的一个问题:

GitHub: GitHub:

StackOverflow:堆栈溢出:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM