今天中午开始学习spring boot,结果一中午都卡在了pom.xml配置上。因为spring boot需要引入一个parent project,
pom.xml文件中:
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.20.RELEASE</version>
</parent>
然后parent节点就各种报错。查了各种资料,报错的原因应该是本地仓库没有这个jar,所以回去中央仓库找,但是中央仓库的服务器设在国外,不是那么容易连接,因此报错。
解决方法:配置阿里云镜像。找到maven安装目录下的conf/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>
回到eclipse中update一下maven项目,报错解除。(别忘了选上Force Update of Snapshots/Releases,强制更新以来jar包)