Site icon 峰哥分享

SBT dependency download problem

When run SBT, none of the dependencies can be downloaded.

I got this error:

Server access Error: sun.security.validator.ValidatorException: PKIX path
building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target url=

The reason is that the HTTP client used by JAVA doesn’t trust any HTTPS
certificate. You have to add all the certificates to the trustStore.

Solution:

Instead of adding many certificates. I only added fiddler’s certificate.
This is a easier way to do it. I enable SSL decryption on my Fiddler
(windows). This will make fiddler to resign all the packets. Then I export
fiddler’s root certificate to the desktop.

Use the following command to generate a keystore file.

keytool -import -file %userprofile%\Desktop\FiddlerRoot.cer -keystore
FiddlerKeystore -alias Fiddler

I then copy this keystore file to the project folder.

Set the SBT_OPTS environment as below.

export SBT_OPTS="$SBT_OPTS -Dhttps.proxyHost=192.168.1.69 -Dhttps.proxyPort=8888 -Djavax.net.ssl.trustStore=/Users/fengnz/FiddlerKeystore -Djavax.net.ssl.trustStorePassword=yourpassword"

Then run sbt command again, the problem resolved.

And I can see all the downloading from Fiddler too.

Exit mobile version