1. 程式人生 > >eclipse中SpringBoot的maven專案出現無法解析父類的解決辦法

eclipse中SpringBoot的maven專案出現無法解析父類的解決辦法

  在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即可解決問題。&n