我在私有網路中運行 AWS Codebuild,為此我創建了檔案.gradle/gradle.properties以使用代理,并且在其中包含以下值:
systemProp.https.proxyHost=<https-proxy-host>
systemProp.https.proxyPort=<https-port>
systemProp.http.proxyHost=<http-proxy-host>
systemProp.http.proxyPort=<http-port>
systemProp.http.nonProxyHosts=localhost|127.0.0.1
我正在使用 AWS 的 Ubuntu 標準映像版本 5.0 進行構建,但在運行時不斷收到此錯誤./gradlew clean build:
Downloading https://services.gradle.org/distributions/gradle-6.8.3-bin.zip
Exception in thread "main" javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.
老實說,我不確定 gradle 是否知道該檔案.gradle/gradle.properties或不獲取代理值,有什么想法嗎?
uj5u.com熱心網友回復:
確保檢查 GRADLE_USER_HOME 環境變數。
如果未設定,則默認路徑為 USER_HOME/.gradle)
最壞的情況 Senario,只是為了確保它不是代理問題,
您可以將 gradle.properties 添加到您的專案中,在 build.gradle 旁邊。
Actullay 有 3 個地方可以使用 gradle.properties:
- USER_HOME/.gradle/gradle.properties,這是所有 gradle 專案的全域變數
- 在專案目錄中,這是該專案的本地目錄
- A 子專案目錄
一旦您嘗試在專案中使用 gradle 屬性但問題仍未解決,這可能是代理問題。
在使用 gradlew 時,您可以嘗試去,
[project]/gradle/wrapper/gradle-wrapper.properties
并添加它(如果尚不存在)以及代理設定。
distributionUrl=http\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
只需確保從 https 中洗掉“s”即可。
雖然這對于某些用戶來說可能看起來不太好,但在這里,接受的答案建議如下
sudo dpkg --purge --force-depends ca-certificates-java
sudo apt-get install ca-certificates-java
然后讓 gradlew 干凈。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/311266.html
標籤:等级 aws-codebuild
