Skip ssl certificates check for Maven in Jenkins - maven

I am trying to integrate Jenkins maven plugin to pull dependencies from a local nexus server. When the build starts I end up with the following Error
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I have tried to disable it by suppling the following wagon ssl properties as MAVEN_OPTS:
-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true
I have also tried to add the certificate to the
javahome/lib/security/cacerts of the JVM.
using the key tool
are there any additional things I should try to disable the self-signed certificate check.

Related

Springboot Gradle : PKIX path building failed

I am trying to build some services in my local. But while building I am getting following error
A problem occurred configuring root project 'MyService'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE.
Required by:
project :
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE.
> Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.2.7.RELEASE/spring-boot-gradle-plugin-2.2.7.RELEASE.pom'.
> Could not HEAD 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.2.7.RELEASE/spring-boot-gradle-plugin-2.2.7.RELEASE.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Similar PKIX issue I am facing with all the services.
I am using IntelliJ and project uses Gradle.
This is also a new system, but I have installed JDK in the macOS. And JDK path shows correctly in the project.
When I open the dependency URL I am able to access in my chrome browser.
Most solution given seems to be for windows.
Anything differently do I have to do for macOS?

Unable to skip ssl verification with gradle command but able to do so in maven

I am currently using gradle publish command but unable to do so, due to PKIX path building failed unable to find valid certification path to requested target
when I tried with mvn deploy command
mvn deploy -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true --debug
It worked fine.
I want to achieve same with gradle.
Create the gradle.properties file:
systemProp.http.ssl.insecure=true
systemProp.http.ssl.allowall=true
systemProp.http.ssl.ignore.validity.dates=true

Error when configuring TeamCity's Artifactory plugin

I have installed the Teamcity Artifactory plugin on my Teamcity 10 but when I configure the artifactory by providing the server URL and doing the Test Connection it gives below error:
Error occurred while requesting version information: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (javax.net.ssl.SSLHandshakeException)
It seems that the TeamCity instance is unable to reach your Artifactory instance.
Can you do a ping call from the TeamCity to Artifactory? Even better will be to run the Artifactory REST API call for the system ping, using your defined URL of Artifactory in TeamCity.
The REST should look like that:
curl -u user:password "https://{artifactoryURL}:{port}/artifactory/api/system/ping"
After running this from TeamCity instance see if you are able to reach the Artifactory instance.
Also, do you have any proxy server between TeamCity to Artifactory? From the error it seems like there is a proxy server in the middle, if so please follow the instructions on how to configure the TeamCity Artifactory plugin to go via the proxy server here.

Maven+Nexus+Jenkins SSL certificate error

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]
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.
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.

Maven : PKIX path building failed

Maven build throwing this exception
Failed to execute goal on project mdf-portal-3rdParty: Could not
resolve dependencies for project
com.alu.ipprd.bsm.soa:mdf-portal-3rdParty:jar:0.0.1-SNAPSHOT: Failed
to collect dependencies at
com.alu.ipprd.bsm.soa.portal.soo:common:jar:0.0.1-SNAPSHOT: Failed to
read artifact descriptor for
com.alu.ipprd.bsm.soa.portal.soo:common:jar:0.0.1-SNAPSHOT: Could not
transfer artifact
com.alu.ipprd.bsm.soa.portal.soo:common:pom:0.0.1-SNAPSHOT from/to
googlecode.com
(http://gmaps4jsf.googlecode.com/svn/trunk/gmaps4jsf-repo):
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target -> [Help 1]
I did not made any single change in pom.xml file ,suddenly after taking update from SVN i am getting this exception.
I will want to know
What is the cause of this problem?
Is this issue due to anything change in SVN server?
Even no any change in local machine why this build fail error?
Something wrong with Gmaps4jsf repository ?(May be due to closing of Google code)
maybe your maven version isnot the proper version. I encounter this problem in 3.2.3. and resolve it in 3.3.9 version.
you need to add ssl certificate to your jre installation
Please refer this answer and follow steps!
Step 1 - Get Root CA certificate
Step 2 - install that certificate at jre cacerts file

Resources