【发布时间】:2017-06-20 08:10:22
【问题描述】:
更新:查看 Caleb 回答中的解决方案
我正在努力让 Coverity 为我的构建工作,但到目前为止收效甚微。
首先是细节:
- 我的项目运行的是 mill java 库(没有 web 或花哨的容器),很少只编译依赖项,使用 Gradle 构建
- 生产代码是用 Java 和 Kotlin 编写的
- 完整的项目在github上:https://github.com/ddimtirov/nuggets
- 在 Coverity Scan 上:https://scan.coverity.com/projects/ddimtirov-nuggets?tab=project_settings
- 我的开发环境是 Windows 10、Java 1.8.0_92、Gradle 3.3、CMD shell(虽然我也尝试过 Cygwin 和 Mingw Bash)
- 还有基于 Linux 构建的 Travis
我首先从https://scan.coverity.com/download/java/win64 下载了一个包
然后我将 bin 目录添加到我的路径中,转到我的项目根目录并运行以下命令。
$ set PATH=%PATH%;C:\Users\dimit\sandbox\cov-analysis\bin
$ gradlew clean
$ cov-build --dir cov-int gradlew jar
前两个按预期进行,最后一个 - 不是那么多:
Coverity Build Capture (32-bit) version 8.7.0 on Windows 10 Professional, 64-bit (build 14393)
Internal version numbers: b452b3f2c8 p-lodi-push-28091.612
The system cannot execute the specified program.
[WARNING] Build command gradlew.bat jar exited with code 1. Please verify that the build completed successfully.
[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.
For more details, please look at:
C:/Users/dimit/sandbox/nuggets/cov-int/build-log.txt
我已将构建日志放在这里:https://gist.github.com/ddimtirov/9daa0e9f1f0954453f01fcec42ae2198
说明页面上的“Troubleshoot build failure”指向了一个论坛索引页面,这根本没有帮助:https://software-community-synopsys.force.com/s/#4838
继续前进,我想如果我只能以其他方式生成数据,我可以将其上传到扫描服务并绕过问题。我找到了https://github.com/mjdetullio/gradle-coverity-plugin
Gradle Coverity 插件发出了数据,但是当我将其压缩并上传到扫描服务时,它会发送错误电子邮件。
作为最后的手段,我尝试了 TravisCI 集成 - 经过几次尝试后,我完成了它而没有出现错误,但它似乎没有上传任何东西......
https://travis-ci.org/ddimtirov/nuggets/builds/196307253 https://scan.coverity.com/projects/ddimtirov-nuggets?tab=overview
我快要放弃了(顺便说一句,没有在线文档也无济于事)
【问题讨论】:
-
查看你发布的构建日志,执行
gradlew.bat时什么也没发生,控制台似乎在说无论你试图执行什么,“系统无法执行指定的程序”(即出现来自您的构建命令,而不是 Coverity。您是否尝试过直接运行该命令以查看会发生什么? -
当我运行
gradlew jar时,它会编译并构建一个 JAR。此外,如果您查看链接的 TravisCI 作业,您会发现在 linux 服务器上运行时会产生不同的输出。
标签: java gradle kotlin coverity