SpringBoot、SpringCloud和SpringCloudAlibaba的版本对应问题

一、SpringBoot、SpringCloud和SpringCloudAlibaba的版本对应关系

1. 毕业版本依赖关系(推荐使用)

Spring Boot VersionSpring Cloud VersionSpring Cloud Alibaba Version
2.4.2Spring Cloud 2020.0.12021.1
2.3.2.RELEASESpring Cloud Hoxton.SR92.2.6.RELEASE
2.1.13.RELEASESpring Cloud Greenwich.SR62.1.4.RELEASE
2.2.5.RELEASESpring Cloud Hoxton.SR32.2.1.RELEASE
2.2.X.RELEASESpring Cloud Hoxton.RELEASE2.2.0.RELEASE
2.1.X.RELEASESpring Cloud Greenwich2.1.2.RELEASE
2.0.X.RELEASESpring Cloud Finchley2.0.4.RELEASE(停止维护,建议升级)
1.5.X.RELEASESpring Cloud Edgware1.5.1.RELEASE(停止维护,建议升级)

2. SpringCloudAlibaba各组件间版本对应关系

Spring Cloud Alibaba VersionSentinel VersionNacos VersionRocketMQ VersionDubbo VersionSeata Version
2.2.6.RELEASE1.8.11.4.24.4.02.7.81.3.0
2021.1 or 2.2.5.RELEASE or 2.1.4.RELEASE or 2.0.4.RELEASE1.8.01.4.14.4.02.7.81.3.0
2.2.3.RELEASE or 2.1.3.RELEASE or 2.0.3.RELEASE1.8.01.3.34.4.02.7.81.3.0
2.2.1.RELEASE or 2.1.2.RELEASE or 2.0.2.RELEASE1.7.11.2.14.4.02.7.61.2.0
2.2.0.RELEASE1.7.11.1.44.4.02.7.4.11.0.0
2.1.1.RELEASE or 2.0.1.RELEASE or 1.5.1.RELEASE1.7.01.1.44.4.02.7.30.9.0
2.1.0.RELEASE or 2.0.0.RELEASE or 1.5.0.RELEASE1.6.31.1.14.4.02.7.30.7.1

依赖管理

Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。

RELEASE 版本
Spring Cloud 2020
如果需要使用 Spring Cloud 2020 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2021.1</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Hoxton
如果需要使用 Spring Cloud Hoxton 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.2.6.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Greenwich
如果需要使用 Spring Cloud Greenwich 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.1.4.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Finchley
如果需要使用 Spring Cloud Finchley 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.0.4.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Edgware
如果需要使用 Spring Cloud Edgware 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>1.5.1.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

3. 孵化器版本依赖关系(不推荐使用)

Spring Cloud VersionSpring Cloud Alibaba VersionSpring Boot Version
Spring Cloud Greenwich0.9.0.RELEASE2.1.X.RELEASE
Spring Cloud Finchley0.2.X.RELEASE2.0.X.RELEASE
Spring Cloud Edgware0.1.X.RELEASE1.5.X.RELEASE
Note请注意, Spring Cloud Edgware 最低支持 Edgware.SR5 版本

依赖管理

Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。

RELEASE 版本
Spring Cloud Greenwich
如果需要使用 Spring Cloud Greenwich 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>0.9.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Finchley
如果需要使用 Spring Cloud Finchley 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>0.2.2.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Spring Cloud Edgware
如果需要使用 Spring Cloud Edgware 版本,请在 dependencyManagement 中添加如下内容

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>0.1.2.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

github Spring Cloud Alibaba 如何构建

  • 2020.0 分支对应的是 Spring Cloud 2020,最低支持 JDK 1.8。
  • master 分支对应的是 Spring Cloud Hoxton,最低支持 JDK 1.8。
  • greenwich 分支对应的是 Spring Cloud Greenwich,最低支持 JDK 1.8。
  • finchley 分支对应的是 Spring Cloud Finchley,最低支持JDK 1.8。
  • 1.x 分支对应的是 Spring Cloud Edgware,最低支持 JDK 1.7。

版本管理规范

项目的版本号格式为 x.x.x 的形式,其中 x 的数值类型为数字,从 0 开始取值,且不限于 0~9 这个范围。项目处于孵化器阶段时,第一位版本号固定使用 0,即版本号为 0.x.x 的格式。

由于 Spring Boot 1 和 Spring Boot 2 在 Actuator 模块的接口和注解有很大的变更,且 spring-cloud-commons 从 1.x.x 版本升级到 2.0.0 版本也有较大的变更,因此我们采取跟 SpringBoot 版本号一致的版本:

  • 1.5.x 版本适用于 Spring Boot 1.5.x
  • 2.0.x 版本适用于 Spring Boot 2.0.x
  • 2.1.x 版本适用于 Spring Boot 2.1.x
  • 2.2.x 版本适用于 Spring Boot 2.2.x
  • 2021.x 版本适用于 Spring Boot 2.4.x