Как составить отчет по отчету о покрытии проекта JACOCO в XML, JACOCO EXEC - PullRequest
1 голос
/ 11 мая 2019

Я настраиваю покрытие Sonarqube.Могу ли я использовать IntelliJ JaCoCo для отчета о покрытии в формате xml и jacoco exec?У меня есть отчет о покрытии IntelliJ JaCoCo в формате html.Можно ли преобразовать отчет в формате html в отчет в формате xml и выполнить exec?

<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>

1 Ответ

0 голосов
/ 14 мая 2019

Пожалуйста, посмотрите пример, который создает exec в директиве target / cover-reports:

 <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>
...