2017-02-24 38 views
0

我一直在試圖讓gradle下載一個來自HTTPS URL的插件,並且無法爲我的數字生活做出我在做什麼錯誤。從我在互聯網上閱讀的內容來看,這通常是通過設置一個代理來解決的 - 我擁有這個代理,並且從調試日誌中看到gradle似乎正在使用它。我也嘗試手動添加列出調試日誌中的所有URL證書到我的cacerts文件無濟於事。Gradle無法通過代理從HTTPS下載插件

調試日誌 - 由gradle這個對springboot插件進行最後的重定向 - 如下圖所示:

Redirecting to 'https://jcenter.bintray.com/org/springframework/boot/spring-boot-tools/1.4.3.RELEASE/spring-boot-tools-1.4.3.RELEASE.pom' via {tls}->http://myProxy:2020->https://jcenter.bintray.com:443 
can be kept alive indefinitely 
Connection released: [id: 204][route: {tls}->http://myProxy:2020->https://plugins.gradle.org:443][total kept alive: 2; route allocated: 1 of 2; total allocated: 2 of 20] 
CookieSpec selected: default 
Auth cache not set in the context 
Connection request: [route: {tls}->http://myProxy:2020->https://jcenter.bintray.com:443][total kept alive: 2; route allocated: 0 of 2; total allocated: 2 of 20] 
Connection leased: [id: 206][route: {tls}->http://myProxy:2020->https://jcenter.bintray.com:443][total kept alive: 2; route allocated: 1 of 2; total allocated: 3 of 20] 
Opening connection {tls}->http://myProxy:2020->https://jcenter.bintray.com:443 
Connecting to myProxy/myProxyIp:2020 
Connection established myIp:64916<->myProxyIp:2020 
Tunnel to target created. 
Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2] 
Enabled cipher suites:[Removed for readability] 
Starting handshake 
http-outgoing-206: Shutdown connection 
Connection discarded 
http-outgoing-206: Close connection 
Connection released: [id: 206][route: {tls}->http://myProxy:2020->https://jcenter.bintray.com:443][total kept alive: 2; route allocated: 0 of 2; total allocated: 2 of 20] 
Flushing resolved configuration data in Binary store in C:\Temp\gradle7433380394459999850.bin. Wrote root 2. 
Timing: Running the build script took 1.082 secs 

FAILURE: Build failed with an exception. 

* What went wrong: 
A problem occurred configuring root project 'TutorialHelloWorld'. 
> Could not resolve all dependencies for configuration ':classpath'. 
    > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE. 
    Required by: 
     project : 
     > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE. 
     > Could not parse POM https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/1.4.3.RELEASE/spring-boot-gradle-plugin-1.4.3.RELEASE.pom 
      > Could not resolve org.springframework.boot:spring-boot-tools:1.4.3.RELEASE. 
       > Could not resolve org.springframework.boot:spring-boot-tools:1.4.3.RELEASE. 
        > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-tools/1.4.3.RELEASE/spring-boot-tools-1.4.3.RELEASE.pom'. 
        > Could not GET 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-tools/1.4.3.RELEASE/spring-boot-tools-1.4.3.RELEASE.pom'. 
         > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 

* Try: 
Run with --stacktrace option to get the stack trace. 

BUILD FAILED 

我可以通過我的瀏覽器,它也使用了代理,這樣應該沒下載此文件。這與Java 1.8.0_71-b15和gradle 3.4一樣。

我也嘗試了從同一臺機器在沒有代理的網絡上(也沒有代理配置爲gradle)的相同的命令,並最終出現相同的錯誤,所以它似乎是這樣的東西與我的環境,而不是代理。

任何想法可能會發生什麼?

+1

用'-Djavax.net.debug = all'再試一次,這樣你就可以看到證書鏈上發生了什麼。顯然,瀏覽器認爲有效的證書與JDK8的信任庫之間的內容不匹配。 –

回答

0

我最後在我最後一次編輯後重新啓動機器,現在gradle build命令似乎工作正常;我不確定重新啓動會發生什麼變化,或者它是否會保持這種狀態,但至少現在它似乎正在工作。