英文:
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:
- Sample Maven repos with Jacoco coverage: https://github.com/SonarSource/sonar-scanning-examples
- Importing Jacoco coverage using XML format: https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151
For more help, you should ask your question in Sonar Community where the official Sonar employees reside to help.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论