写在之前:百度上抄来抄去那些文章都是屎、害人不浅啊。
声明::cobertura或者jacoco只支持单模块的测试。都是会编译当前module下的类。即使全部配置文件配置正确,如果当前moudle下没有类。也不会生成相应的index.html文件。
搞了三天。把操蛋的问题记录一下:
a:不生成index.html:jacoco配置的excutions配置错误或者maven-surefire-plugin的版本有误(见下方)。或者当前模块下没有类。
b:生成的index.html覆盖了为零:没有配置好maven-surefire-plugin的incluede属性
c: 找不到对应的jacoco.exec:没有指定好jacoco-maven-plugin的prepare-agent
集成jacoco步骤:
1:父类的完整pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"