在我的项目中,使用circleCI和codecov进行Springboot maven项目。
下面是. .circleci/config.yml的相关部分
# run tests! and gen code coverage
- run: mvn integration-test cobertura:cobertura
- store_test_results:
path: target/surfire-reports
- run:
name: Send to CodeCov
command: bash <(curl -s https://codecov.io/bash)enter code here而maven插件是:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check/>
</configuration>
</plugin>并使用默认的codecov.yml,可以找到这里。
循环构建是成功的,我确实生成了一个codecov报告,但是代码覆盖率仅针对项目引导包中的com.x.y.bootstrap文件。
下面是来自codecov站点的存储库图像。

我正在寻找的是完整的代码覆盖整个项目。
发布于 2019-09-10 17:37:53
我认为问题是由于cobertura-maven-plugin没有获取正确的源类路径;因此生成了无效数据的报告。我更新了项目,使其使用jacoco-maven-plugin,并简单地使用以下方法运行测试:
POM文件更改如下:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>之后一切都值了。
https://stackoverflow.com/questions/57804269
复制相似问题