当前位置: 首页 > 知识库问答 >
问题:

Jacoco:报告-聚合要么得到浅覆盖,要么根本没有

陈胤
2023-03-14
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jacoco-aggregate ---
[INFO] Deleting <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (filter) @ jacoco-aggregate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\src\main\resources
[INFO] 
[INFO] --- depends-maven-plugin:1.2:generate-depends-file (generate-depends-file) @ jacoco-aggregate ---
[INFO] Created: <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target\classes\META-INF\maven\dependencies.properties
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.8:report (default-report) @ jacoco-aggregate ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.4:jar (module-javadoc-jar) @ jacoco-aggregate ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.8:report-aggregate (report-aggregate) @ jacoco-aggregate ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.8:merge (merge) @ jacoco-aggregate ---
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-account-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-core-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-creditcheck-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-ordercreation-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-payment-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-productandoffer-impl\target\jacoco.exec
[INFO] Writing merged execution data to <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target\jacoco.exec
[INFO] 
<artifactId>jacoco-aggregate</artifactId>
<version>2.3.0-SNAPSHOT</version>
<name>jacoco-aggregate</name>
<packaging>pom</packaging>
<dependencies>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-account-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-core-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-creditcheck-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-csi-jaxb-base</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-ordercreation-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-payment-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-productandoffer-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>com.att.detsusl</groupId>
       <artifactId>usl-servicefactory-impl</artifactId>
       <version>2.3.0-SNAPSHOT</version>
       <scope>compile</scope>
   </dependency>
   <dependency>
    <groupId>com.att.detsusl</groupId>
    <artifactId>usl-csi-icas-impl</artifactId>
    <version>2.3.0-SNAPSHOT</version>
    <scope>compile</scope>
   </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.8</version>
            <executions>
                <execution>
                    <id>report-aggregate</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>report-aggregate</goal>
                    </goals>
                </execution>
                <execution>
                   <id>merge</id>
                   <phase>verify</phase>
                   <goals>
                       <goal>merge</goal>
                   </goals>
                   <configuration>
                       <fileSets>
                           <fileSet>
                               <directory>${project.basedir}/../usl-account-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-core-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-creditcheck-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-csi-jaxb-base/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-ordercreation-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-payment-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-productandoffer-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                           <fileSet>
                               <directory>${project.basedir}/../usl-servicefactory-impl/target</directory>
                               <includes>
                                <include>*.exec</include>
                               </includes>
                           </fileSet>
                       </fileSets>
                   </configuration>
                </execution>
              <execution>
                  <id>prepare-agent</id>
                  <phase>none</phase>
                  <goals>
                      <goal>prepare-agent</goal>
                  </goals>
              </execution>
                <execution>
                    <id>default-instrument</id>
                    <phase>none</phase>
                    <goals>
                        <goal>instrument</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-restore-instrumented-classes</id>
                    <phase>none</phase>
                    <goals>
                        <goal>restore-instrumented-classes</goal>
                    </goals>
                </execution>
                <execution>
                   <id>report</id>
                  <phase>none</phase>
                   <goals>
                       <goal>report</goal>
                   </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

在“jacoco-aggregate”中手动运行构建之前,我查看了其他模块中引用的几个“jacoco.exec”文件,它们都存在并且是非空的。

共有1个答案

曾枫
2023-03-14

首先--似乎是在report-aggrege之后进行merge,所以最后一次看不到jacoco.exec

还要注意report-aggrege查看Reactor项目,即如果您有

root
  \child_1
  \child_2

然后,在rootmvn...中执行mvn...时,reactor将包含所有3个,而在执行CD child2&&mvn...reactor将仅包含child2

 类似资料:
  • 当运行Gradle的Jacoco插件时,我在一组选定的类上得到零代码覆盖率报告。我已经确认测试这些类的所有单元测试都已成功运行。 非常有趣的是,EclEmma在Eclipse中生成了正确的代码覆盖率结果。我已经确认这两个工具使用的是相同版本的Jacoco。 我想知道这两种工具的区别是什么?我需要Gradle Jacoco插件的额外配置吗。 编辑:我的Gradle Jacoco输出显示“com类的执

  • 您是否曾被测试覆盖度量引入歧途? 测试覆盖工具对单元测试具有重要的意义,但是经常被误用。这个月,Andrew Glover 会在他的新系列 —— 追求代码质量 中向您介绍值得参考的专家意见。第一部分深入地介绍覆盖报告中数字的真实含义。然后他会提出您可以尽早并经常地利用覆盖来确保代码质量的三个方法。 您还记得以前大多数开发人员是如何追求代码质量的吗。在那时,有技巧地放置 main() 方法被视为灵活

  • 我有一个与jacoco的项目,我希望能够过滤某些类和/或包。 我阅读了以下文档: 使用Sonarrunner和Gradle(不使用sonar)从Jacoco报告中排除包 Jacoco-从报表中排除JSP(它似乎适用于maven,我使用的是gradle) Maven Jacoco配置-从不工作的报告中排除类/包(这似乎适用于Maven,我使用的是gradle)

  • 我在测试android以创建覆盖率测试报告时遇到问题。我使用./gradlew createDebugCoverageReport命令创建覆盖率报告。已创建报告,但所有测试的结果均为%0。第一个设备已植根,但第二个设备未植根。我们使用这两个设备测试勺子,并查看勺子输出。所以这两个设备一起使用。问题:当我们使用第一个设备(根设备)运行此命令时,将按预期创建所有覆盖率测试结果,但当我们同时使用两个设备

  • 问题内容: 从不同的代码库执行业务测试时,我必须获得应用程序的代码覆盖率。 我使用:Maven作为我的构建Jbehave作为我的测试框架。测试是用Java编写的。 我的应用程序是部署在tomcat上的一组war文件。 应用程序代码库与测试代码库是分开的。 为了获得覆盖范围,我遵循以下步骤。 1使用maven编译测试代码。 2将应用程序类从其构建位置($ {app.code.dir} / targe