问题描述
在运行spring boot的时候发生了Error:(3, 32) java: 程序包org.springframework.boot不存在等一些列不存在问题,用了网上各种办法,无果。
解决一:
pom文件里的版本过高,修改版本,maven再reimport下,但这不是我的问题
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>//*适当降低版本*
<relativePath/> <!-- lookup parent from repository -->
</parent>
解决二:
没有下载依赖包,点击maven里的lifecycle的install,然后刷新下
解决三:(我的问题的解决)
m2文件里没有自动生成settings.xml文件!
settings文件路径可以再setting里查看,如下图
这时候,就只能自己手动在该路径创建settings.xml文件了,文件配置如下(用的阿里云镜像)
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf></mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url></mirror>
<mirror><id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf></mirror>
</mirrors>
然后再进行解决二的的操作,这时候就能正常下载jar包了,爆红也就随之消失了。