如何实现sonar+failsafe+jacoco?

bf1o4zei  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(262)

我尝试实现sonar+failsafe+jacoco插件。我将theese添加到pom.xml文件中

<dependency>
            <groupId>org.sonarsource.sonarqube</groupId>
            <artifactId>sonar-plugin-api</artifactId>
            <version>7.5</version>
            <scope>provided</scope>
        </dependency>

我把这些插件添加到同一个文件中

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <argLine>--add-modules java.base</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <propertyName>jacoco.agent.argLine</propertyName> <!-- default: argLine -->
                    <includes>
                        <include>**/*IT.java</include>
                    </includes>
                    <destFile>${project.build.directory}/jacoco-it.exec</destFile> <!-- agent -->
                    <dataFile>${project.build.directory}/jacoco-it.exec</dataFile> <!-- report -->
                </configuration>
                <executions>
                    <execution>
                        <id>agent</id>
                        <goals><goal>prepare-agent</goal></goals>
                    </execution>
                </executions>
            </plugin>

它已经存在于我的pom.xml中

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>${it.skip}</skip>
                    <argLine>--add-modules java.base</argLine>
                    <forkCount>4</forkCount>
                    <reuseForks>true</reuseForks>
                    <includes>
                        <include>*IT</include>
                    </includes>
                    <systemPropertyVariables>
                        <doc.skip>${doc.skip}</doc.skip>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

我运行mvn clean verify-p集成测试,然后运行mvnsonar:sonar but 我得到的覆盖率还是0.0%,为什么没有得到它的报告结果呢?请帮帮我。。我的问题是什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题