Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempt

第一次用 Spring Starter Project 创建一个Spring应用时,POM 文件报错:

Project build error: Non-resolvable parent POM for com.example:demo-1:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.5.4.RELEASE from 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. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.5.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: nodename nor servname provided, or not known and 'parent.relativePath' points at no local POM

解决方法:

参考stack overflow:

I've also encountered a lot of error when creating a new STS project for the first time. This seems to be happen only if I don't have any Maven repository or haven't launch/use Maven before. In my case, I solve this by launching Maven command from command line manually. Try to 'cd' to the project directory that contains pom.xml and call mvn that comes with STS from there.

cd c:\users\name\sts-projects\projectname
c:\programs\springsource\apache-maven-3.0.3\bin\mvn compile
Then, open STS, right click on project name, select 'Maven', 'Update Project...' Select on 'Force Update of Snapshots/Releases'. Don't select 'Offline'.

即打开终端,进入出错项目的根目录,然后使用 maven bin 目录下的 mvn 编译一下,完成之后右键项目 Maven——Update Project 即可。

全部评论

相关推荐

06-04 09:27
门头沟学院 Java
点赞 评论 收藏
分享
面了这么多场试,总有公司总喜欢压力面一个小时面试+手撕,哪里不会就点哪里,说了不会不会还继续追着问不尊重求职者,稍微有些细节记不清了,就开始怀疑项目真实性以及人格让求职者开摄像头但是自己不开,说话声音还贼小,pardon几次就开始不耐烦的不知道这个算不算,手撕的时候,面试官人跑了。。。最后快结束才来
一纸丿繁华丶:你换位思考一下,自己在职场被领导push麻了,身心俱疲,现在有个机会让你放松一下,体验一把上位者的感觉,还能看着那些高学历人才、未来自己的竞争者,抓耳挠腮、手足无措的样子,没给你当场笑出来就不错了,理解一下面试官吧。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务