Jenkins在deploy maven artifact时报Peer not authenticated.
这是一起由Nexus证书导入错误造成的Jenkins运行异常。
最近,同事修改了Nexus服务器的host name,结果导致Jenkins里的任务全都执行不了了。虽然job的配置都已经更新指向新的Nexus地址,但是,当job将编译好的artifact上传到Nexus服务器时Jenkins总是报Peer not authenticated错误。Jenkins master/slave通过SSL访问Nexus。
...
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving D:\workspace\workspace\mmmmmmm parent\pom.xml to com.mmmmmmm/parent/2.1.0.2-SNAPSHOT/parent-2.1.0.2-SNAPSHOT.pom
channel stopped
Maven RedeployPublisher use remote slave001 maven settings from : d:\apache-maven-3.3.9\conf\settings.xml
[INFO] Deployment in https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/ (id=snapshots,uniqueVersion=true)
Deploying the main artifact parent-2.1.0.2-SNAPSHOT.pom
Downloading: https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/de/mmmmmmm/parent/2.1.0.2-SNAPSHOT/maven-metadata.xml
ERROR: Failed to retrieve remote metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml from/to snapshots (https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/): peer not authenticated
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to retrieve remote metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml from/to snapshots (https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/): peer not authenticated
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143)
at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:193)
at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:176)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1037)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to retrieve remote metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml from/to snapshots (https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/): peer not authenticated
at org.eclipse.aether.internal.impl.DefaultDeployer.upload(DefaultDeployer.java:470)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:314)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:269)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
... 11 more
Caused by: org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata com.mmmmmmm:parent:2.1.0.2-SNAPSHOT/maven-metadata.xml from/to snapshots (https://nnnnnnn.mmmmmmm.local:10000/nexus/content/repositories/mmmmmmm-next-snapshots/): peer not authenticated
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$5.wrap(WagonRepositoryConnector.java:995)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$5.wrap(WagonRepositoryConnector.java:983)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.maven.wagon.TransferFailedException: peer not authenticated
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:892)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:660)
... 4 more
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source)
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.maven.wagon.shared.http4.ConfigurableSSLSocketFactoryDecorator.connectSocket(ConfigurableSSLSocketFactoryDecorator.java:64)
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.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:746)
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:886)
... 8 more
[INFO] Deployment failed after 0.48 sec
Build step 'Deploy artifacts to Maven repository' changed build result to FAILURE
Finished: FAILURE
问题初步分析。在修改Nexus host name之前,Jenkins master/slave一直可以访问Nexus,各个job也都工作正常。而出现的问题是Peer not authenticated,说明Jenkins和Nexus的SSL连接上出现了问题。由于是SSL连接,而且Nexus又刚刚改掉了host name,所以初步怀疑是证书(certificate)出了问题。
新证书是同事做好了的,所以我只需要从Nexus的keystore中导出证书(cert),并将cert导入到Jenkins的master和slave JDK的cacerts里就好了。接下来使用portacle工具将cert导入到Jenkins master设备的JDK cacerts文件中,以及slave的JDK cacerts文件中。重启Jenkins和slave, 尝试执行job。问题依旧存在。
经过查阅资料,仔细对比,发现Jenkins自带JRE,其并不是使用的标准安装的JDK。所以,Nexus的新证书导入到标准JDK的cacerts文件中对于Jenkins来说是无用的。而,Jenkins使用的JRE定位在这里:C:\medavis\service\Jenkins\jre。Nexus的新证书应该导入到这个JRE的cacerts文件中。遂立即导入证书,重启Jenkins master。然后执行job,确认问题已经解决。
Jenkins在deploy maven artifact时报Peer not authenticated.的更多相关文章
- eclipse 配置Maven问题解决办法:新建maven工程时报错:Could not resolve archetype org.apache.maven.archetypes .
此文乃本作者配置maven,被其折磨n天,究极解决方案,好文要顶啊.欢迎致电: zhe-jiang.he@hp.com 首先各maven.archetypes下载地址: http://mirrors. ...
- [原]Jenkins(二)---jenkins之Git+maven+jdk+tomcat
/** * lihaibo * 文章内容都是根据自己工作情况实践得出. *版权声明:本博客欢迎转发,但请保留原作者信息! http://www.cnblogs.com/horizonli/p/5331 ...
- k8s下的jenkins如何设置maven
关于k8s环境的jenkins集群 k8s下搭建了jenkins集群后,执行任务时会新建pod,任务完成后pod被销毁,架构如下图所示: 在k8s搭建jenkins集群的步骤请参照<> 关 ...
- 解决:mvn archetype:create Abstract class or interface 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2 .3:create (default- ...
- jenkins+docker 持续构建非docker in docker jenkins docker svn maven
工欲善其事必先利其器,为了解脱程序员的,我们程序员本身发明了很多好用的工具,通过各种工具的组合来达到我们想要的结果 本文采用jenkins docker svn maven作为相关工具,项目sprin ...
- Jenkins Jenkins结合GIT Maven持续集成环境配置
Jenkins结合GIT Maven持续集成环境配置 by:授客 QQ:1033553122 安装Git插件 1 安装Git客户端 1 安装JAVA JDK及MAVEN 2 Jenkins JDK ...
- 在jenkins中调用maven的变量
Maven内置变量说明: ${basedir} 项目根目录(即pom.xml文件所在目录) ${project.build.directory} 构建目录,缺省为target目录 ${project. ...
- Jenkins实现SVN+Maven+Java项目的持续集成
Jenkins 2.46.1 Centos 7.3 JDK 7 安装jdk/maven/svn 在Jenkins所在的Linux机器安装jdk和maven,步骤就不说了,下面是环境变量: export ...
- 创建Maven Module时报错:The parent project must have a packaging type of POM
创建Maven Module时报错:The parent project must have a packaging type of POM 解决的办法,是把父项目的Packaging改成pom:
随机推荐
- android volley 发送 POST 请求
Map<String, String> params = new HashMap<String, String>(); params.put("fromUser&qu ...
- 【Lua】关于遍历指定路径下所有目录及文件
关于Lua中如何遍历指定文件路径下的所有文件,需要用到Lua的lfs库. 首先创建一个temp.lua文件,用编辑器打开: 要使用lfs库,首先需要把lfs库加载进来 require("lf ...
- 编写规范的javascript
js代码,前端都会写.但细节决定成败,代码是否优雅.规范,可以看得出一个JScoder的水平来. 曾经多次被项目组长吐槽,并被授予一本秘笈,上面有关于JS编程规范的一些总结. 无奈秘笈不能长借,无奈只 ...
- 「Sdchr 的邀请赛」题解
骗个访问量.. A:取石子 将点 x 与点 x / prime 连边,那么这个图可以由指数之和的奇偶性来划分成一个二分图. 接下来考虑推广阶梯 NIM (或者这原本就是阶梯 NIM ?),必胜当且仅当 ...
- Db - DataAccess
/* Jonney Create 2013-8-12 */ /*using System.Data.OracleClient;*/ /*using System.Data.SQLite;*/ /*us ...
- 项目开发-->基础功能汇总
祭奠曾经逝去的青春…… 1.基础功能汇总-->身份认证及用户登录模块 2.基础功能汇总-->一键登录功能汇总 3.堆和栈 4.变量
- git 命令记录贴
记录下最近使用git的场景. 问题 1:将一个完整的项目发布到已创建好的git地址(码云) 执行步奏: 1.配置自己的公钥 2.检查是否连接成功 $ ssh -T git@git.oschina.ne ...
- Chetsheet: 2017 01.01 ~ 01.31
Web TypeScript: the missing introduction Async HTTP API and service bus Optimizing the Performance o ...
- java多线程之ReentrantLock
前言 相信学过java的人都知道 synchronized 这个关键词,也知道它用于控制多线程对并发资源的安全访问,兴许,你还用过Lock相关的功能,但你可能从来没有想过java中的锁底层的机制是怎么 ...
- js数组的splice函数
一直没搞懂数组的splice函数,今天稍微测试了一下,了解了它的功能,在这里记录一下 1.测试 测试① var a = [1,2,3]; console.info(a.splice(1,1)); co ...