如何在使用apache commons-parent的项目中生成JaCoCo XML报告以供Sonarcloud使用?

huangapple go评论60阅读模式
英文:

How can I generate a JaCoCo XML report for Sonarcloud in a project using apache commons-parent?

问题

I'm working on a project and the pom.xml file is a child of apache commons-parent (commons-parent provides common settings for all Apache Commons components). I have to calculate code coverage using JaCoCo and Sonarcloud, but to do so I need the jacoco report to be an xml file, while unfortunately the plugin used in commons-parent outputs a .exec file.

How can I do this?

I tried overriding the jacoco plugin but it still used the parent configuration.

EDIT: Thanks to this answer, I realized I was actually trying to add coverage for a single-module maven project when it actually was a multi-module.

英文:

i'm working on a project and the pom.xml file is a child of apache commons-parent (commons-parent provides common settings for all Apache Commons components). I have to calculate code coverage using JaCoCo and Sonarcloud, but to do so I need the jacoco report to be an xml file, while unfortunately the plugin used in commons-parent outputs a .exec file.
How can I do this?

I tried overriding the jacoco plugin but it still used the parent configuration.

EDIT: Thanks to this answer, I realized I was actually trying to add coverage for a single-module maven project when it actually was a multi-module.

答案1

得分: 1

以下是翻译好的部分:

你有一个示例仓库可以分享吗?关键是确定你是否有一个单模块或多模块的Maven项目,然后你可以设计jacoco-maven-plugin的报告或报告聚合目标。

以下是一些帮助链接:

  • 具有Jacoco覆盖率的示例Maven仓库:https://github.com/SonarSource/sonar-scanning-examples
  • 使用XML格式导入Jacoco覆盖率:https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151

如需更多帮助,您可以在Sonar社区中提出问题,在那里有官方Sonar员工可以提供帮助。

英文:

Do you have an example repository to share? The key point is to determine if you have a single-module or multi-module Maven project and then you can design the report or report-aggregate goal of the jacoco-maven-plugin.

Here are some links to help:

For more help, you should ask your question in Sonar Community where the official Sonar employees reside to help.

huangapple
  • 本文由 发表于 2023年5月25日 02:35:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76326487.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定