在eclipse中建立SpringBoot的maven项目时,继承父类,添加如下代码:

1 <parent>
2     <groupId>org.springframework.boot</groupId>
3     <artifactId>spring-boot-starter-parent</artifactId>
4     <version>1.5.10.RELEASE</version>
5 </parent>

  但有时会出现解析不了父类的POM情况(Project build error:Non-resolvable parent POM),这时只需在pom.xml中添加如下代码:

 1 <repositories>
 2     <repository>
 3         <id>spring-snapshots</id>
 4         <url>http://repo.spring.io/libs-snapshot</url>
 5     </repository>
 6 </repositories>
 7 <pluginRepositories>
 8     <pluginRepository>
 9         <id>spring-snapshots</id>
10         <url>http://repo.spring.io/libs-snapshot</url>
11     </pluginRepository>
12 </pluginRepositories>

  最后再选中项目右键–>Maven–>Update Project即可解决问题。 

版权声明:本文为wuyongji原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/wuyongji/p/11506311.html