Fork me on GitHub

Spring Cloud项目MVN编译 -- Non-resolvable import POM

  最近利用闲余时间,打算搭建一套基于Spring Cloud G版的微服务架构(Spring boot 2.1.0),一顿操作之后,IDEA也没有提示什么错误,自认为微服务搭建完毕。启动项目前,习惯性的Maven -clean了一下,我去,IDEA里面的Maven Projects里面一片红,同时控制台打印出如下错误:

复制代码
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Failure to find org.springframework.cloud:spring-cloud-dependencies:pom:Greenwich.M3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ line 20, column 25
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.jackpot:Logistics-management-platform:1.0-SNAPSHOT (/Users/Jackpot/Project/Logistics-management-platform/pom.xml) has 1 error
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.cloud:spring-cloud-dependencies:pom:Greenwich.M3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ line 20, column 25 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Process finished with exit code 1
复制代码

  错误提示很明显--https://repo.maven.apache.org/maven2里面找不到Spring cloud G版的pom依赖。简单的想了一下,之前的项目中,涉及到Spring的依赖都是https://repo.maven.apache.org/maven2里面的啊,为此我还特地打开网址看了看。

  

  额,为什么这里面的Spring 版本只到了2.0-M4?WTF??之后的版本在哪呢?Spring Cloud G版要求Spring boot版本必须为2.1.X,而Spring boot 2.1.x对应的Spring版本那可是Spring 5啊。遇到了问题,怎么解决了,首先我想到的是去官方文档找答案,乱搜一通,没有找到什么有价值的内容,官方没有明确的答案,那就只有去“民间”找方法了,第一时间想到了stackoverflow,我开发过程中的一大利器。输入Non-resolvable import POM,立马就出现一大堆。搜索排除后,最终锁定了--"https://stackoverflow.com/questions/47280247/non-resolvable-import-pom-failure-to-find",一位码友的答案完美的解决了我的问题,给我指了"明路"。

  

  从这个回答中,很清楚的知道,Spring 2.0.0.M6版本后,依赖文件就不在https://repo.maven.apache.org/maven2里面了,而是在http://repo.spring.io/milestone/org/中,打开网址,一层层搜索,最终找到了http://repo.spring.io/milestone/org/springframework/spring/ ,Spring的所有版本都在这里,那我只需要引入这个仓库,就可以解决问题。

  

  在pom文件加入仓库后,再一次Maven -clean,SUCCESS,然后Maven -compile,SUCCESS,项目也成功启动了。

 

作者:JackpotHan
欢迎任何形式的转载,但请务必注明出处。
限于本人水平,如果文章和代码有表述不当之处,还请不吝赐教。

posted @   JackpotHan  阅读(13231)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示