繁体   English   中英

jacoco的Java代码覆盖率

[英]java code coverage with jacoco

我有下一个项目结构

src/main/java/com/Example.java
src/main/java/com/ExampleMapper.java

我需要获得没有Example类的ExampleMapper代码覆盖率。 我在pom.xml编写

  <plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.1.201405082137</version>
    <executions>
      <execution>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
      </execution>
      <execution>
        <id>report</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>report</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <includes> 
        <include>com/example/**/*Mapper.class</include>
      </includes>
    </configuration>
  </plugin>

但是,我得到0%作为覆盖率输出。

很想解决这个问题?

您需要将其更改为:

<include>com/example/*Mapper*</include>

然后,Jacoco正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM