Coverity工具作为Java应用程序的Docker映像

时间:2019-02-07 16:49:02

标签: java docker coverity

我想创建一个包含所有与Coverity相关的工具的Docker映像。我的目标是对 Java 9 源代码执行代码分析。我正在使用 Gradle 5.1.1 作为构建工具。

对应的Dockerfile是:

FROM openjdk:9-jdk
ADD cov-analysis-linux64-latest.sh .
ADD cov-analysis-linux64-license.dat .
ENV COVERITY_HOME=/opt/cov-platform
RUN set -e; chmod +x cov-analysis-linux64-latest.sh ;\
    ./cov-analysis-linux64-latest.sh \
    -q \
    --installation.dir=${COVERITY_HOME} \
    --license.region=0 \
    --license.agreement=agree \
    --license.type.choice=0 \
    --license.cov.path=/cov-analysis-linux64-license.dat ;\
    rm -f cov-analysis-linux64-*.sh

ENV PATH="${COVERITY_HOME}/bin:${PATH}"
RUN cov-configure --java --version 9 --no-android --no-jsp

docker build命令:

docker build -t cov-test .

容器运行为:

docker run --rm -v ~/my-service:/workspace -it cov-test /bin/bash

在我运行的容器内:

cd workspace
cov-build --dir tmp/coverity/service sh gradlew clean build

输出为:

Coverity Build Capture (64-bit) version 2018.09 on Linux 4.9.125-linuxkit x86_64
Internal version numbers: 2096cfd878 p-othello1-push-33188.942.300
.
.
.
[WARNING] Emitted 0 Java compilation units (0%) successfully

0 Java compilation units (0%) are ready for analysis
 For more details, please look at:
    /workspace/tmp/coverity/service/build-log.txt

从日志文件中:

Using Eclipse FE
invalid location for system libraries: /usr/lib/jvm/java-9-openjdk-amd64
[ERROR] Internal Eclipse error. Failed to emit any files.
[ERROR] Compilation failed! Exit code 1
WARNING: cov-emit-java returned with code 1
ERROR: cov-emit-java returned with exit code 1

我怀疑该错误是由于Coverity(/ usr / lib / jvm / java-9-openjdk-amd64)错误地使用了JDK路径引起的。

问题是如何进行配置?

0 个答案:

没有答案