新建maven springboot项目遇到依赖jar包无法导入问题经验总结

本人小白,跟着b站尚硅谷学springboot
SpringBoot视频教程(idea版)_2018_Java视频_spring boot_springboot核心篇+…
https://www.bilibili.com/video/av38657363/?p=5
视频p05
新建maven项目后,在导入maven的spring jar包依赖时报错

1.一开始无法导入
报错:Unable to import maven project: See logs for details springboot
在这里插入图片描述
有这两个error
在这里插入图片描述

百度了第一个error
No implementation for org.apache.maven.model.path.PathTranslator was bound.
应该是我下载的maven版本过高了
“可能是maven版本过高导致的,我用的maven3.5.4,没有出现过什么问题”
https://ask.csdn.net/questions/789238
于是我换成了maven3.3.9,成功auto-import

加载速度过慢问题
百度:springboot 一直在downloading plugins for

alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central

https://blog.csdn.net/shayboke/article/details/71156393
亲测有用,过了几分钟就下完了

2.添加依赖语句后报错
pom.xml文件中添加
在这里插入图片描述

1.5.9 RELEASE报错
spring-boot-starter-parent报错
spring-boot-starter-web报错
(截图都没报错,是事后截的)

3.第一个报错
在这里插入图片描述
1.5.9.RELEASE找不到
百度:project ‘org.springframework.boot:spring-boot-starter-patent:.RELEASE’ not found
解决方法:
就是找到maven文件的conf文件的settings.xml,在里面添加这个语句

mirrorId
central
Human Readable Name for this Mirror.
http://central.maven.org/maven2/

https://blog.csdn.net/yangqjiayou/article/details/76399907
亲测有用,第一个红色报错解决了,但是用上面那个aliyun的应该也是可以下载RELEASE包的

4.第二个报错
在这里插入图片描述
百度:Dependency ‘org.springframework.boot:spring-boot-starter-web:’ not found inspects a maven m
有人说因为tomcat里原来有个这包,所以新的包导入不进去
https://www.imooc.com/qadetail/253935
但是我试了,对我来说无用

又是tomcat冲突的
https://ask.csdn.net/questions/747582
对我无用

首先我们排除spring-boot-starter-web依赖中的Tomcat:在pom文件中排除tomcat的starter

org.springframework.boot
spring-boot-starter-web


org.springframework.boot
spring-boot-starter-tomcat



https://www.zhangshengrong.com/p/281omKejNw/
亲测无用

乱逛逛到了maven网站
MVN REPOSITORY
https://mvnrepository.com/artifact/org.springframework.boot

这个博主的mirror地址应该是最稳定的
解决方法:
就是找到maven文件的conf文件的settings.xml,在里面添加这个语句


alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/repositories/central/
central


https://blog.csdn.net/leo3070/article/details/81019878
我觉得的地址:central要比下面另一个地址groups/public更加全,更稳定
但是我添加进setting.xml的时候两个都写了

idea使用maven下载不了依赖包问题
这个博主的方法我试了,用一点点用,但是解决不了我的报错
https://www.baidu.com/link?url=3nD5tjqtMgdfglLcsyThQO3z4bM5sXTzGFoFLezwrhzB3cz8VuFBJvyAOSahCDvFZ14y1j5h9b5cBl3pBwrWUBFTKAlPg0k4XSqZOnR_wce&wd=&eqid=e085034100015019000000065d81ed8f
应该可以增加下载jar包的速度

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </repository>
</repositories>
<!--指定远程插件仓库地址 -->
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

其他杂的网站:
添加镜像mirror

alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central

https://blog.csdn.net/Certain_/article/details/90745360
是对的,但是还是报错

其他方法
https://www.cnblogs.com/zealousness/archive/2018/07/21/9345650.html
没试过

最后,问题源自于我自己打错了,
spring-boot-starter-web
被我输入为spring – boot – starter - web
因为是从pdf文档复制过来的(我懒),所以导入的时候是 - ,多了两个空格,识别不了,无法导入jar包
我一直以为是mirror地址的问题,在找比较全比较稳定的mirror地址
一共改了1个多小时吧,终于发现了这个问题(想钻进洞去死)

贴很多个找到的mirror镜像地址大全:
https://blog.csdn.net/steven_zhulin/article/details/90724983

alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central

uk central Human Readable Name for this Mirror. http://uk.maven.org/maven2/ CN OSChina Central http://maven.oschina.net/content/groups/public/ central nexus internal nexus repository http://repo.maven.apache.org/maven2 central

5.过程中学会的一些小技巧:
idea 如何enable auto-import
File->Settings->Maven->Importing->Import Maven projects automatically
在这里插入图片描述
https://blog.csdn.net/nuistcc/article/details/84921200

springboot 依赖下载不下来的问题
在这里插入图片描述
删了repository的文件重装是一个好方法
https://www.oschina.net/question/1421583_2278747

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值