Test coverage statistics in java Jacoco
1. Plug-in dependency
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<configuration>
<!--指定生成 .exec 文件的存放位置-->
<destFile>target/coverage-reports/jacoco-unit.exec</destFile>
<!--Jacoco 是根据 .exec 文件生成最终的报告,所以需指定 .exec 的存放路径-->
<dataFile>target/coverage-reports/jacoco-unit.exec</dataFile>
</configuration>
</plugin>
2. Execute the maven command
mvn clean test
3. Open the report address
The browser opens the index.html page