spring-boot创建项目出现spring-boot-starter-parent版本报红问题

花了一下午折腾了环境问题,填坑…

创建新springboot项目,搭建好了环境,pom.xml文件就报这个问题:version报红

spring-boot创建项目出现spring-boot-starter-parent版本报红问题

 

百度了很多方法,根据其中一个解决办法:

spring-boot创建项目出现spring-boot-starter-parent版本报红问题

 

勾选上图所示,仍然报错:没有找到setting.xml文件,我就创建了setting.xml文件,给了777的权限

还是报错,如下:

Error:(3) java: 程序包springframework.boot不存在,

然后又找了很多解决办法,其中有说将setting.xml文件去掉<mirrors>标签,但是我的setting.xml文件并没有这个,然后我就加了这段:

 

<mirror>

      <id>mirrorId</id>

      <mirrorOf>central</mirrorOf>

      <name>Human Readable Name for this Mirror.</name>

      <url>http://central.maven.org/maven2/</url>

    </mirror>

结果呢,同样报错:Error:(3) java: 程序包springframework.boot不存在,最后我试着将报红的2.0.0的版本改成了随意的更大的版本2.1.6,

竟然开始download了,成功了:

spring-boot创建项目出现spring-boot-starter-parent版本报红问题

最后发现代码文件的spring-boot引用都成了:

spring-boot创建项目出现spring-boot-starter-parent版本报红问题

最后是改的版本号成功了。