If you’re using a certificate for Artifactory's SSL that’s not been issued by a well-known certificate authority, then you’ll need to trust that SSL certificate's root and Intermediate certificates. If you do trust such a certificate, you’ll need to add it manually to Jenkins’ certificate store and to the certificate store(s) of any application(s) that Jenkins uses. Thereafter, Jenkins Artifactory Plugin will call Maven (mvn) to build and deploy artifacts. Alternatively, you can decide to specify a path for your certificate store that the mvn should use during the build.
For example, have a look at the following screenshot:
As depicted, you might declare the certificate store for mvn by using the MAVEN_OPTS environment variable for your Jenkins job; setting the path to the certificate store by using:
-Djavax.net.ssl.trustStore={the-path-to-the-certificate-store}
Otherwise, you might see the following errors during your build:
[ERROR] org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: java.lang.RuntimeException: Error occurred while publishing artifact to Artifactory: /app/jenkins/jobs/XXXXX(omitted)XXXX. Skipping deployment of remaining artifacts (if any) and build info. at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:277) at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy(BuildDeploymentHelper.java:98) at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded(BuildInfoRecorder.java:170) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:64) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:170) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:185) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.maven.Maven3Builder.call(Maven3Builder.java:136) at hudson.maven.Maven3Builder.call(Maven3Builder.java:71) at hudson.remoting.UserRequest.perform(UserRequest.java:120) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:332) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:431) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:437) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.jfrog.build.client.PreemptiveHttpClient.execute(PreemptiveHttpClient.java:88) at org.jfrog.build.client.ArtifactoryHttpClient.execute(ArtifactoryHttpClient.java:199) at org.jfrog.build.client.ArtifactoryHttpClient.upload(ArtifactoryHttpClient.java:195) at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:618) at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:329) at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:275) … 29 more [ERROR] Internal error: java.lang.RuntimeException: org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: Error occurred while publishing artifact to Artifactory: /app/jenkins/jobs/XXX(Ommitted)