Include JMockit Coverage in Sonarqube Dashboard

I am looking for a way to incorporate the JMockit-Coverage reports of my multi-module Java project into our SonarQube managing this project. We already have Cobertura reports at Sonar, but I would like both to be easily accessible for comparison.

The JMockit document talks about something to create a coverage.ser file, I did not go there, as I am not sure if this file will be useful for Sonar or not.

+4
source share
1 answer

Cannot include .ser file in sonar export.

BUT, you can add a Jacoco dependency that will use JMockit coverage to create a report that will use sonar.

    <profile>
        <id>coverage</id>

        <dependencies>
            <dependency>
                <groupId>org.jmockit</groupId>
                <artifactId>jmockit-coverage</artifactId>
                <version>${jmockit.version}</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <coverage-classes>com.mypackage.*</coverage-classes>
                            <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

, cobertura jmockit.

0

All Articles