'How to bypass SSL verification for Gradle 4.5?

I am getting this error while trying to connect to Nexus Maven proxy repository, but Nexus is running over HTTPS with a self-signed certificate.

How can I bypass SSL verification in this scenario in Gradle 4.5?

sun.security.validator.validatorexception pkix path building failed 
sun.security.provider.certpath.suncertpathbuilderexception: 
  unable to find valid certification path to requested target


Solution 1:[1]

it works for me with below gradle.properties

systemProp.javax.net.ssl.trustStore=$JAVA_HOME//jre//lib//security//cacerts
systemProp.javax.net.ssl.trustStorePassword=changeit

Solution 2:[2]

In my case, we did not have access to import certificates in cacerts. But, we were able to install the certificates in Windows Trusted Root Certification Authority. In gradle.properties, after adding below 2 properties, I was able to override cacerts and get over the SSL issue

systemProp.javax.net.ssl.trustStore=C:\\Windows\\win.ini
systemProp.javax.net.ssl.trustStoreType=Windows-ROOT

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Behrang
Solution 2 Sourabh