1

I have installed certificate to nexus. When i start jenkins builder im getting an error:

[ERROR] Failed to execute goal on project wf-base: Could not resolve dependencies for project 1.0.0o-SNAPSHOT: Failed to collect dependencies at 1.0.0o-SNAPSHOT: 

Failed to read artifact descriptor for 1.0.0o-SNAPSHOT: Could not transfer artifact 1.0.0o-SNAPSHOT from/to Nexus (https://nexus.repository.link): 

sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
Danylo
  • 21
  • 1
  • 4

2 Answers2

1

Here are some options for those of you (like me) who stumbled on this issue.

1. Import CA in java trust store

The first option is to import your certificate authority(ies) in your jre cacert file using keytool.

This option, although it seems to be the most natural, has one drawbacks: this implies to have write access to the JRE / JDK folders, which is not always the case.

2. Pass trust store as a param to the JVM in Maven using Jenkins

Here is the trick: maven passes a set of parameters to the jvm before it runs. These parameters are wrapped in a variable called MAVEN_OPTS wihch are initialized in the mvn script.

The way to go when using Jenkins is to create an environment variable in your slave or your job, call it MAVEN_OPTS and give it the JVM option:

MAVEN_OPTS
-Djavax.net.ssl.trustStore=your_custom_cert_file

As always, there are many other possibilities but these two are the cleanest ones.

avi.elkharrat
  • 6,100
  • 6
  • 41
  • 47
0

Looks like you're missing a certificate in the chain so your certificate isn't trusted,if it's a self signed certificate you'll need to add it as a root certificate. If the certificate was issued by a CA you'll need to download the missing certificate(s) in the chain and install them.

Matt
  • 12,569
  • 4
  • 44
  • 42
  • all of these components are behind proxy, is it important or not? – Danylo May 23 '17 at 18:21
  • i have found this thread: https://stackoverflow.com/questions/7851153/unable-to-proxy-maven-repo-over-https-ssl-with-nexus the right answer said that i need to add my certificate into truststore, not in keystore. im gonna try this and remind you when it will be finished – Danylo May 23 '17 at 18:25