2014-09-05 32 views
0

Java代碼覆蓋率我有一個下一個項目結構與jacoco

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

我需要獲得代碼覆蓋率爲ExampleMapper沒有Example類。我寫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%作爲覆蓋輸出。

熱點解決這個問題?

回答

0

你需要把它改成這樣:

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

然後,Jacoco正常工作。