当你使用
mvn clean test org.jacoco:jacoco-maven-plugin:0.8.1:prepare-agent install -Dmaven.test.failure.ignore=true
mvn org.jacoco:jacoco-maven-plugin:0.8.1:report
或者
mvn clean -N -U org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report -Dmaven.test.failure.ignore=false -DskipTests=false
发现没有exec文件以及html report 生成的时候 ,简单改一下你的Pom.xml就可以了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<forkMode>once</forkMode>
<reuseForks>true</reuseForks>
<testFailureIgnore>true</testFailureIgnore>
<includes>
<include>**/*Test.java</include>
<include>**/*Test*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/au/com/xxx/config/*</exclude>
<exclude>au/com/xxx/util/**</exclude>
<exclude>au/com/xxx/transformer/**</exclude>
</excludes>
</configuration>
<executions><!-- Generate .exec file -->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution><!-- Generate report -->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${jacoco.reportPath}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>