OpenJDK9(Docker),分级4.2.1,GitLab

我的项目使用graddlew 4.2.1在本地构build。 但是当我把它推到GitLab,我得到下面的错误。 我必须使用Docker,所以我不知道我可以使用这个Docker Image来工作。 这也是gitlab-ci.yml:

# This file is a template, and might need editing before it works on your project. # This template uses the java:8 docker image because there isn't any # official Gradle image at this moment # # This is the Gradle build system for JVM applications # https://gradle.org/ # https://github.com/gradle/gradle image: openjdk:9-jdk # Disable the Gradle daemon for Continuous Integration servers as correctness # is usually a priority over speed in CI environments. Using a fresh # runtime for each build is more reliable since the runtime is completely # isolated from any previous builds. variables: GRADLE_OPTS: "-Dorg.gradle.daemon=false" # Make the gradle wrapper executable. This essentially downloads a copy of # Gradle to build the project with. # https://docs.gradle.org/current/userguide/gradle_wrapper.html # It is expected that any modern gradle project has a wrapper before_script: - chmod +x gradlew # We redirect the gradle user home using -g so that it caches the # wrapper and dependencies. # https://docs.gradle.org/current/userguide/gradle_command_line.html # # Unfortunately it also caches the build output so # cleaning removes reminants of any cached builds. # The assemble task actually builds the project. # If it fails here, the tests can't run. build: stage: build script: - ./gradlew -g /cache/.gradle clean assemble allow_failure: false artifacts: name: "AudioBot" paths: - build/libs/*.jar 

这里的错误:

线程“main”中的exceptionjavax.net.ssl.SSLException:java.lang.RuntimeException:意外的错误:java.security.InvalidAlgorithmParameterException:在java.base / sun.security.ssl.Alerts处,trustAnchors参数必须是非空的。在java.base / sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1921)上的java.base / sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1969)上的getSSLException(Alerts.java:214)在java.base / sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1904)在java.base / sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1436)在java.base / sun.security .ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)at java.base / sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)at java.base / sun.net.www.protocol .base上的java.base / sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1563)上的.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) un.org.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1491)在java.base / sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:236)在org.gradle。在org.gradle.wrapper.Ingall $ 1.call(Install.java:62)org.gradle.wrapper.Download.download(Download.java:51)的wrapper.Download.downloadInternal(Download.java:66)。在org.gradle.wrapper.Install.createDist(Install.java:48)at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)处,安装$ 1.call(Install.java:48)。 org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)引起:java.lang.RuntimeException:意外的错误:java.security.InvalidAlgorithmParameterException :在java.base / sun.security.validator.PKIXValidator上的trustAnchors参数必须是非空的(java.lang.Think.security.validator.Validator.getI(PKIXValidator.java:89))。 java.base / sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:180)上的java.base / sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:330)上的nstance(Validator.java:181)在java.base / sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:192)在java.base / sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:133)在java.base / sun.security .ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1825)at java.base / sun.security.ssl.ClientHandshaker.certificateStatus(ClientHandshaker.java:1676)at java.base / sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker .java:272)在java.base / sun.security.ssl.Handshaker.processRecord(Handshaker.java:1020)在java.base / sun.security.ssl.Handshaker.processLoop(Handshaker.java:1086)。 base / sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1137)at java.base / sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl .java:1074)at java.base / sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402)at java.base / sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)。 base / sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1429)… 14更多原因:java.security.InvalidAlgorithmParameterException:在java.base / java.security.cert中,trustAnchors参数必须是非空的.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)at java.base / java.security.cert.PKIXParameters。(PKIXParameters.java:120)at java.base / java.security.cert.PKIXBuilderParameters。(PKIXBuilderParameters.java:104 )在java.base / sun.security.validator.PKIXValidator。(PKIXValidator.java:86)… 29更多错误:作业失败:退出代码1

如果有人能帮助我,那将会很好。 谢谢! 🙂

这是Docker镜像中可能存在的Debian错误。 他们的工作我认为: https : //github.com/docker-library/openjdk/issues/145

为了解决这个问题,你可以使用jdk-9-slim图像。 只需添加-slim。

为了testing,您可以在docker-library / openjdk上创build一个基础。

请参阅docker-library/openjdk issue 19
ca-certificates-java.postinst configure应该在PR 111之后 ,但是如果在“ Error – trustAnchors参数必须是非空的 ”中提到的另一种方法,您可以在自定义映像中进行testing。

请注意, moby / moby问题18180曾经影响了ca-certificates-java.postinst configure ,但应该现在就可以了。