Could not resolve dependencies for project

Jenkins服务 迁移到新机器后,项目无法完成下载,报错:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.097 s
[INFO] Finished at: 2018-01-22T16:54:28+08:00
[INFO] Final Memory: 10M/103M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data[ERROR] Failed to execute goal on project test-api: Could not resolve dependencies for project net.protest:test-api:war:1.0.4-SERVER: The following artifacts could not be resolved: net.protest:test-commons:jar:1.1.0-SERVER, net.protest:test-service:jar:1.0.4-SERVER: Could not find artifact net.protest:test-commons:jar:1.1.0-SERVER -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

[JENKINS] Archiving /home/jenkins/.jenkins/workspace/api_build_api0-2/pom.xml to net.protest/test-api/1.0.4-SERVER/test-api-1.0.4-SERVER.pom
channel stopped
Finished: FAILURE

解决方法:

将旧jenkins服务器上maven安装目录下settings.xml文件导入新的jenkins服务器中:

旧jenkins服务器文件位置:~/.m2/settings.xml
新服务器位置如下,将settings.xml文件替换:

# find / -name settings.xml
    /usr/maven/conf/settings.xml       

# ln -s /usr/maven/conf/settings.xml /home/jenkins/.m2/settings.xml

本文转自奔跑在路上博客51CTO博客,原文链接http://blog.51cto.com/qiangsh/2063755如需转载请自行联系原作者


qianghong000

点赞