gpt4 book ai didi

java - 如何将 intellij maven 项目 jacoco 覆盖率报告专家转为 xml、jacoco exec

转载 作者:太空宇宙 更新时间:2023-11-04 09:40:07 25 4
gpt4 key购买 nike

我正在设置 Sonar 覆盖范围。我可以将 IntelliJ JaCoCo 覆盖率报告专家转换为 xml 格式并进行 jacoco 执行吗?我有 IntelliJ JaCoCo 覆盖率报告 html 格式。我可以将 html 格式的报告转换为 xml 格式的报告并执行吗?

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<properties>
<slf4j.version>1.7.25</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.sources>src/main/java</sonar.sources>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
</properties>

最佳答案

请参阅在 target/coverage-reports 目录中创建 exec 的示例:

 <executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed. -->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>

关于java - 如何将 intellij maven 项目 jacoco 覆盖率报告专家转为 xml、jacoco exec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56088033/

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