在Maven的pom中,添加配置信息,excludes中添加的文件或类即为不进行单元测试的文件。该配置中,entity和utils目录下的所有文件将不进行单元测试。
1<plugins> 2 <plugin> 3 <groupId>org.codehaus.mojo</groupId> 4 <artifactId>cobertura-maven-plugin</artifactId> 5 <version>2.6</version> 6 <configuration> 7 <formats> 8 <format>xml</format> 9 </formats> 10 <instrumentation> 11 <excludes> 12 <exclude>com/**/demo/entity/*</exclude> 13 <exclude>com/**/demo/utils/*</exclude> 14 </excludes> 15 </instrumentation> 16 </configuration> 17 </plugin> 18</plugins>