Pulling gradle distributionUrl through artifactory remote-simple repository results in javax.net.ssl.SSLHandshakeException


Pulling gradle distributionUrl through artifactory remote-simple repository results in javax.net.ssl.SSLHandshakeException



How can I tell gradle wrapper to trust my artifactory's cert without modifying every machine that uses it or am I pulling through artifactory in the wrong way?



My artifactory uses a self signed cert and my systems are set to trust this. Within a gradle build, access to the artifactory repos works wonderfully for my dependencies but gradlew less so.



To improve build reliability, we added an artifactory simple remote repository for https://services.gradle.org/distributions/gradle-... but see the following when we build:



gradle-wrapper.properties


distributionUrl=https://artifactory01.megacorp.us/remote-simple-artifactory/distributions/gradle-4.0.2-all.zip



Error


Exception in thread "main" javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target



It sure looks like gradlew is treating artifactory as a man-in-the-middle (which in essence it is).



What's the right way to do this?




1 Answer
1



The error is caused because JAVA that Artifactory runs on does not have root certificate of the remote URL trusted on its trusted root certificate store.



Furthermore, please refer to the following knowledge base article regarding PKIX.



An additional option, in case your URL has a trailing '/' at the end which can lead to a redirect to a secure location of the remote repository






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

List of Kim Possible characters

Audio Livestreaming with Python & Flask

NSwag: Generate C# Client from multiple Versions of an API