我的设置包括 Travis-ci、通过 maven pom 的 Jacoco 插件、Codecov 和 Java10。尝试设置代码覆盖功能时,travis-ci 在评估 codecov-bash 脚本时输出语法错误(请参阅Travis ci 输出中的最后 2 行)
.travis.yml
language: java
jdk: oraclejdk10
after_success:
- bash <(curl -s https://codecov.io/bash)
pom.xml
<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>
特拉维斯 ci 输出
[INFO] Results:
[INFO]
[WARNING] Tests run: 174, Failures: 0, Errors: 0, Skipped: 7
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.2:report (report) @ PROJECT ---
[INFO] Loading execution data file /home/travis/build/x/y/target/jacoco.exec
[INFO] Analyzed bundle 'PROJECT' with 14 classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.121 s
[INFO] Finished at: 2018-09-20T20:25:14Z
[INFO] Final Memory: 18M/512M
[INFO] ------------------------------------------------------------------------
The command "mvn test -B" exited with 0.
after_success
0.00s$ bash < (curl -s https://codecov.io/bash)
/home/travis/.travis/job_stages: eval: line 98: syntax error near unexpected token `('
/home/travis/.travis/job_stages: eval: line 98: `bash < (curl -s https://codecov.io/bash) '
Done. Your build exited with 0.
我阅读了有关如何使用 jacoco 和 travis ci 设置 codecov 的每篇文章,通过 cobertura 绕道只是为了弄清楚 Java10 不受支持并阅读更改日志以查看某些版本是否不兼容。
我在配置我的构建时是否犯了任何错误,或者是codecov-bash有问题?在本地运行时mvn:test
,我确实得到了预期的 jacoco.csv、jacoco.xml 和 index.html 文件。