1. 程式人生 > 實用技巧 >Could not transfer artifact :the trustAnchors parameter must be non-empty錯誤解決

Could not transfer artifact :the trustAnchors parameter must be non-empty錯誤解決

現象

maven進行 install的時候報如下錯誤,專案可以正常啟動,說明只是從中心倉庫獲取資料報錯

[ERROR] Failed to execute goal on project spring-servlet: Could not resolve dependencies for project com.kouryoushine:spring-servlet:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework:spring-webmvc:jar:5.0.6.RELEASE: Failed to read artifact descriptor for org.springframework:spring-webmvc:jar:5.0.6.RELEASE: Could not transfer artifact org.springframework:spring-webmvc:pom:5.0.6.RELEASE from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]

原因

我是用了兩個的JDK,舊的JDK沒有正確的證書,即使使用了正確的javac,Maven也會選擇那個舊的JDK

解決

file-project structure 選擇正確安裝的證書
在這裡插入圖片描述