I'm running AWS Codebuild within a private network, for that I have created the file .gradle/gradle.properties
to use a proxy and inside it I have the following values:
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
I'm using AWS's Ubuntu standard image version 5.0 for the build, but I keep getting this error when I run ./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.
To be honest I'm not sure if gradle is aware of the file .gradle/gradle.properties
or not to get the proxy values, any thoughts?
CodePudding user response:
Make sure to check for GRADLE_USER_HOME environment variable .
which if not set , the defaults path is USER_HOME/.gradle)
Worst case Senario , just to make sure its not a proxy issue ,
you can add the gradle.properties to your project , next to build.gradle .
Actullay there is 3 places where you can have gradle.properties:
- USER_HOME/.gradle/gradle.properties and this is global for all gradle projects
- In project directory , and this is local for this project
- A The sub-project directory
once you tried to have the gradle properties in the project and the issue not solved , probably this is a proxy problem .
while your working with gradlew , You can try to go to ,
[project]/gradle/wrapper/gradle-wrapper.properties
and add this if not already exist , as well as proxy setting .
distributionUrl=http\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
Just make sure to remove the 's' from https .
while this may not look fine for some users , here, the accepted answer suggested the following
sudo dpkg --purge --force-depends ca-certificates-java
sudo apt-get install ca-certificates-java
and make gradlew clean afterward .