Maven MultiModule项目的发行代码范围

时间:2019-05-15 06:27:24

标签: maven sonarqube code-coverage jacoco

当前,我们正在尝试获取多级模块maven项目的代码覆盖率。下面是相同的代码段

parent
 - child1
   - sub-child1
   - sub-child2
 - child2
   - sub-child1
   - sub-child2
pom.xml

我们使用了Jacoco插件并尝试生成代码覆盖率,但似乎并没有生成任何jacoco可执行文件。

任何相同的指导都会很有帮助

尝试引用并执行相同的操作 https://github.com/acntech/jacoco-multimodule-maven

<properties>
        <jacoco.version>0.7.9</jacoco.version>
        <sonar.jacoco.reportPaths>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPaths>
        <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
        <sonar.language>java</sonar.language>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>agent-for-ut</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <append>true</append>
                            <destFile>${sonar.jacoco.reportPaths}</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>agent-for-it</id>
                        <phase>package</phase>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                        <configuration>
                            <append>true</append>
                            <destFile>${sonar.jacoco.itReportPath}</destFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

我希望jacoco插件生成一个exe文件,并将结果推送到sonarqube

0 个答案:

没有答案
相关问题