Spring相关项目是一个庞大的家族,除了Spring Framework之外,还有Spring Boot,Spring Cloud等。这些项目和其他开源项目有个明显区别,就是他们之间是有相互依赖的。比如Spring Boot依赖Spring Framework,Spring Cloud又依赖Spring Boot等。
Spring相关项目的主开发分支是master分支。而master分支依赖的其他Spring项目也是snapshot版本的。比如,当我们下载了Spring Cloud Gateway项目之后,它的pom.xml中的parent是如下定义的:
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
因此,它依赖的其他Spring项目的版本号也是Snapshot的。这体现了Spring项目家族同步开发,同步发布的特点。
而Snapshot在maven的中央仓库是没有的。因为它不稳定,只要重新构建就会去下载最新构建的版本。
所以,Spring在每个项目的pom.xml文件中都配置了repository。比如
<profile>
<id>spring</id>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>