我的设置包括Travis-ci,通过maven pom,Codecov和Java10编写的Jacoco插件。 尝试设置代码覆盖功能时,travis-ci在评估codecov-bash脚本时会输出语法错误(请参阅 Travis ci输出 中的最后两行)
.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>
Travis 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文件。