我试图让codecov运行并处理Jacoco为我的多构建Java Gradle项目生成的报告。然而,当我运行codecov脚本(bash <(curl -s https://codecov.io/bash))时,我得到了以下输出:
x> No CI provider detected.
Testing inside Docker? http://docs.codecov.io/docs/testing-with-docker
Testing with Tox? https://docs.codecov.io/docs/python#section-testing-with-tox
project root: .
Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
--> No coverage report found.
Please visit http://docs.codecov.io/docs/supported-languages我已经验证了这些报告是由build/reports/jacoco/codeCoverageReport中的jacoco创建的,并且xml实际上是存在的。
我按照指南这里(吉特布)设置了jacoco报告。我的gradle代码和github上的代码的主要区别是我排除了xml.destination "${buildDir}/reports/jacoco/report.xml",因为Gradle将无法处理包含它的代码。
.codecov.yml
codecov:
require_ci_to_pass: true
coverage:
precision: 3
round: up
range: "70...100"
status:
project: true
patch: yes
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: yes
macro: no
comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: false发布于 2019-10-24 03:40:05
我想通了。运行bash <(curl -s https://codecov.io/bash) -h列出了我可以使用的选项,其中我发现有一个-f <file>选项可以指定要使用的确切文件。
从这里开始,我只需在我的travis文件中使用它来正确地上传:
bash <(curl -s https://codecov.io/bash) -f build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml
发布于 2020-12-26 14:48:59
我在java15中使用maven
添加到pom.xml中(在build部分下):
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>添加到.travis.yml中:
script:
- mvn clean package
after_success:
- bash <(curl -s https://codecov.io/bash)对我来说效果很好。
https://stackoverflow.com/questions/58526042
复制相似问题