问题描述
更新:查看Caleb解决方案的答案
我很努力地让Coverity为我的构建工作,但到目前为止
第一个细节:
- 我的项目运行的是Java库(没有web或花哨的容器),使用Gradle构建的非常少的仅编译依赖性
- 生产代码使用Java和Kotlin编写
- 完整的项目在github上可用:
- 然后在Coverity扫描上:
- 我的开发环境是Windows 10,Java 1.8.0_92,Gradle 3.3,CMD shell(尽管我也试过Cygwin和Mingw Bash)也有Tr avis在Linux上构建
我从以下地址下载软件包开始:
然后我添加了bin目录到我的路径,去我的项目根目录并运行以下命令。 $ set PATH =%PATH%; C:\ Users \dimit\sandbox\cov-analysis\bin
$ gradlew clean
$ cov-build --dir cov-int gradlew jar
$ c
前两个按预期走,最后一个 - 没那么多:
Windows 10 Professional(64位版本)中的Coverity Build Capture(32位)版本8.7.0
内部版本号:b452b3f2c8 p-lodi-push-28091.612
系统无法执行指定的程序。
[警告]用代码1退出生成命令gradlew.bat jar。请确认构建已成功完成。
[警告]没有文件被发射。这可能是由于您的配置
存在问题,或者因为您的build命令没有真正编译文件。
请确保您已经配置了编译中实际使用的编译器。
详情请参阅:
C:/Users/dimit/sandbox/nuggets/cov-int/build-log.txt
我在这里放置了构建日志:
在说明页面上的排除故障指向论坛索引页,完全没有帮助:
接下来,我想如果我只能以其他方式生成数据,我可以将其上传到扫描服务,绕过这个问题。我发现
Gradle Coverity插件发布了这些数据,但是当我将其压缩并上传到扫描服务时,它会发送错误电子邮件。
作为最后的手段,我尝试了TravisCI集成 - 经过几次尝试后,我完成了没有错误,但它似乎没有上传任何东西......
我接近放弃(顺便说一下,没有可用的在线文档不会帮助)
解决方案
问题1 - 系统canno t执行指定的程序。
出现此问题是因为使用Windows 32位套件来尝试捕获Windows 64位版本。尝试将32位进程附加到64位进程导致执行失败。
- 这里的解决方案是匹配位的Coverity二进制文件(使用Windows 64位套件)。
问题2 - 未能捕获TravisCI版本在Linux上
这个问题似乎是由于Coverity的Java Capture和ErrorProne插件之间不兼容导致的,如构建日志中的消息所证明的那样:警告:使用类加载器net.ltgt.gradle.errorprone将加载类文件java / io / FileNotFoundException.class作为资源失败。 ErrorProneCompiler $ SelfFirstClassLoader @ 36358417
- 这里的解决方案是禁用该插件Coverity build。
Varia
- 在调试问题时,讨论了干扰Coverity的Gradle守护进程的已知问题d,但最终与问题无关。
- prepend命令提到的问题是用户错误; prepend命令不是一个单独的命令来运行,它是出于实用目的。
UPDATE: See the solution in Caleb's answer
I am trying really hard to make Coverity work for my build, but so far with little success.
First the details:
- My project is run of the mill java library (no web or fancy containers), very few compile-only dependencies, built using Gradle
- The production code is written in Java and Kotlin
- The complete project is available on github: https://github.com/ddimtirov/nuggets
- And on Coverity Scan: https://scan.coverity.com/projects/ddimtirov-nuggets?tab=project_settings
- My development environment is Windows 10, Java 1.8.0_92, Gradle 3.3, CMD shell (though I also tried Cygwin and Mingw Bash)
- there is also Travis build on Linux
I started by downloading a package from: https://scan.coverity.com/download/java/win64
Then I added the bin directory to my path, went to my project root and ran the following commands.
$ set PATH=%PATH%;C:\Users\dimit\sandbox\cov-analysis\bin
$ gradlew clean
$ cov-build --dir cov-int gradlew jar
The first 2 went as expected, the last - not so much:
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
I have put the build log here: https://gist.github.com/ddimtirov/9daa0e9f1f0954453f01fcec42ae2198
The "Troubleshoot build failure" on the instructions page was pointing to a forum index page, which does not help at all: https://software-community-synopsys.force.com/s/#4838
Moving on, I thought that if I could only generate the data in some other way I could upload it to the scan service and bypass the problem. I found https://github.com/mjdetullio/gradle-coverity-plugin
The Gradle Coverity plugin emitted the data, but when I zipped it and uploaded to the scan service, it barfed the error email.
As last resort, I tried the TravisCI integration - after a few attempts, I got it to complete without an error, but it didn't seem to upload anything...
https://travis-ci.org/ddimtirov/nuggets/builds/196307253https://scan.coverity.com/projects/ddimtirov-nuggets?tab=overview
I am close to giving up (BTW, not having docs available online doesn't help)
Issue 1 - "The system cannot execute the specified program."
This issue arose because a Windows 32-bit kit was used to attempt to capture a Windows 64-bit build. The attempt to attach a 32-bit process to a 64-bit one causes failure to execute.
- The solution here is to match the bitness of Coverity binaries with the bitness of your platform (use a Windows 64-bit kit).
Issue 2 - Failure to capture TravisCI build on Linux
This issue appears to be due to an incompatibility between Coverity's Java Capture and the ErrorProne plugin, as evidenced by messages such as this one in the build log:
WARNING: Failed load class file java/io/FileNotFoundException.class as a resource using the class loader net.ltgt.gradle.errorprone.ErrorProneCompiler$SelfFirstClassLoader@36358417
- The solution here is to disable that plugin for the Coverity build.
Varia
- When debugging the issue, the known issue of the Gradle daemon interfering with Coverity was discussed, but was ultimately not relevant to the issue.
- The noted issues with the "prepend" command are user error; the prepend command is not a separate command to run, it's there for utility purposes.
这篇关于无法使Coverity Scan工作(Windows和Travis上的Java / Kotlin / Gradle 3.3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!