首页 > 解决方案 > Gradle 在容器内部不起作用,但在外部起作用

问题描述

出于某种原因,在 docker 容器中,gradle 不适用于我。当然,在容器之外它工作正常。奇怪的是它并没有说明缺少什么文件或目录。

# ./gradlew clean -s

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'foo-bar'.
  > Could not resolve com.google.protobuf:protobuf-gradle-plugin:0.8.9.
     > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-gradle-plugin/0.8.9/protobuf-gradle-plugin-0.8.9.pom'.
        > org.apache.http.ssl.SSLInitializationException:  (No such file or directory)

Caused by: java.io.FileNotFoundException:  (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at org.gradle.internal.resource.transport.http.DefaultSslContextFactory$SslContextCacheLoader.initTrustManagerFactory(DefaultSslContextFactory.java:146)
        at org.gradle.internal.resource.transport.http.DefaultSslContextFactory$SslContextCacheLoader.load(DefaultSslContextFactory.java:119)
        ... 248 more

标签: dockergradle

解决方案


似乎问题在于javax.net.ssl.trustStore被设置为空白并覆盖默认值,这也解释了为什么 FileNotFoundException 似乎没有指定值。


推荐阅读