歪麦博客

Maven/Gradle 编译错误解决:java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Maven 或者 Gradle 编译遇到如下问题:

➜ idaas git:(main) ./gradlew build
> Task :generateProto FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateProto'.
> Could not resolve all files for configuration ':protobufToolsLocator_protoc'.
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
Required by:
project :
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
> Could not get resource 'https://maven-central.storage-download.googleapis.com/repos/central/data/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> Could not GET 'https://maven-central.storage-download.googleapis.com/repos/central/data/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

解决:升级 JDK 版本或者使用新版本

我出问题时使用的版本是从 Oracle 官网下载的 JDK 1.8.0_41

更换到 Open JDK 1.8.0_292 解决。

退出移动版