介绍

pom中加入

<build>
	<plugins>

		<plugin>
			<groupId>org.jacoco</groupId>
			<artifactId>jacoco-maven-plugin</artifactId>
			<version>0.7.5.201505241946</version>
			<executions>
				<execution>
					<id>prepare-agent</id>
					<goals>
						<goal>prepare-agent</goal>
					</goals>
				</execution>
				<execution>
					<id>report</id>
					<phase>prepare-package</phase>
					<goals>
						<goal>report</goal>
					</goals>
				</execution>
				<execution>
					<id>post-unit-test</id>
					<phase>test</phase>
					<goals>
						<goal>report</goal>
					</goals>
					<configuration>
						<dataFile>target/jacoco.exec</dataFile>
						<outputDirectory>target/jacoco-ut</outputDirectory>
					</configuration>
				</execution>
			</executions>
		</plugin>

	</plugins>
</build>

执行

mvn clean package

点击targer/jacoco-ut目录下的index.html即可
Maven工程配置代码覆盖工具Jacoco
依次点进各级目录查看即可
Maven工程配置代码覆盖工具Jacoco

参考博客

[1]https://my.oschina.net/wangmengjun/blog/974067

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2021-08-04
  • 2021-06-03
  • 2021-07-14
  • 2021-12-02
  • 2021-11-23
相关资源
相似解决方案