外观
依赖版本管理(BOM)
2026-03-05
nebula-support-dependencies 是一个 Maven BOM(Bill of Materials),统一声明所有第三方依赖的版本。项目引入后,使用受管依赖时无需指定版本号,且版本升级只需修改 BOM 一处。
引入方式
有两种引入方式,根据是否使用 nebula 构建插件选择:
通过插件自动导入(推荐)
// build.gradle
nebula {
nebulaVersion = '0.1.2-SNAPSHOT' // 对应 nebula-support-dependencies 版本
enableDependencyManagement = true // 默认为 true,保持即可
}手动引入(不使用插件时)
// build.gradle
dependencies {
implementation platform('com.huida.nebula.support:nebula-support-dependencies:0.1.2-SNAPSHOT')
// 无需指定版本
implementation 'com.baomidou:mybatis-plus-spring-boot3-starter'
implementation 'cn.hutool:hutool-all'
}依赖使用示例
按常用分类列出引入示例(均无需写版本号):
持久层
dependencies {
// MyBatis-Plus
implementation 'com.baomidou:mybatis-plus-spring-boot3-starter'
implementation 'com.baomidou:mybatis-plus-extension'
// 多数据源
implementation 'com.baomidou:dynamic-datasource-spring-boot3-starter'
// Druid 连接池
implementation 'com.alibaba:druid-spring-boot-3-starter'
}缓存
dependencies {
// Redisson(Spring Boot 整合)
implementation 'org.redisson:redisson-spring-boot-starter'
// 按 Spring Data 版本选择适配包
implementation 'org.redisson:redisson-spring-data-35'
}工具库
dependencies {
// Hutool(按需引入具体模块,或引入全量包)
implementation 'cn.hutool:hutool-core'
implementation 'cn.hutool:hutool-json'
implementation 'cn.hutool:hutool-http'
// implementation 'cn.hutool:hutool-all' // 全量(包体较大)
// Guava
implementation 'com.google.guava:guava'
}API 文档
dependencies {
// Knife4j(OpenAPI 3,基于 SpringDoc)
implementation 'com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter'
// 或直接使用 SpringDoc
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui'
}服务治理
dependencies {
// 分布式事务
implementation 'io.seata:seata-spring-boot-starter'
// 流量控制
implementation 'com.alibaba.csp:sentinel-core'
implementation 'com.alibaba.csp:sentinel-datasource-nacos'
}测试
dependencies {
// Testcontainers(集成测试容器)
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:redis'
}完整版本表
BOM 当前版本基于 Spring Boot 3.5.9,各组件版本如下:
Spring 生态(来自官方 BOM)
| 依赖 | 版本 | 说明 |
|---|---|---|
| Spring Boot | 3.5.9 | 基础 BOM |
| Spring Cloud | 2025.0.0 (Northfields) | 兼容 Spring Boot 3.5.x |
| Spring Cloud Alibaba | 2025.0.0.0 | 兼容 Spring Boot 3.5.x |
持久层
| 依赖(groupId:artifactId) | 版本 |
|---|---|
com.baomidou:mybatis-plus-spring-boot3-starter | 3.5.9 |
com.baomidou:mybatis-plus-annotation | 3.5.9 |
com.baomidou:mybatis-plus-core | 3.5.9 |
com.baomidou:mybatis-plus-extension | 3.5.9 |
com.baomidou:mybatis-plus-generator | 3.5.9 |
com.baomidou:dynamic-datasource-spring-boot3-starter | 4.3.1 |
org.apache.shardingsphere:shardingsphere-jdbc | 5.5.1 |
com.alibaba:druid-spring-boot-3-starter | 1.2.24 |
服务治理
| 依赖 | 版本 |
|---|---|
com.alibaba.nacos:nacos-client | 2.4.3 |
com.alibaba.csp:sentinel-core | 1.8.8 |
com.alibaba.csp:sentinel-datasource-nacos | 1.8.8 |
com.alibaba.csp:sentinel-transport-simple-http | 1.8.8 |
io.seata:seata-spring-boot-starter | 2.2.0 |
消息队列
| 依赖 | 版本 |
|---|---|
org.apache.rocketmq:rocketmq-client-java | 5.3.1 |
org.apache.rocketmq:rocketmq-spring-boot-starter | 2.3.1 |
缓存
| 依赖 | 版本 |
|---|---|
org.redisson:redisson | 3.52.0 |
org.redisson:redisson-spring-boot-starter | 3.52.0 |
org.redisson:redisson-spring-data-35 | 3.52.0 |
安全
| 依赖 | 版本 |
|---|---|
com.github.ulisesbocchio:jasypt-spring-boot-starter | 3.0.5 |
工具库
| 依赖 | 版本 |
|---|---|
cn.hutool:hutool-all / hutool-core / hutool-json / hutool-crypto / hutool-extra | 5.8.34 |
org.mapstruct:mapstruct | 1.6.3 |
org.mapstruct:mapstruct-processor | 1.6.3 |
com.google.guava:guava | 33.4.0-jre |
org.projectlombok:lombok | 1.18.36 |
API 文档
| 依赖 | 版本 |
|---|---|
com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter | 4.5.0 |
org.springdoc:springdoc-openapi-starter-webmvc-ui | 2.7.0 |
org.springdoc:springdoc-openapi-starter-webflux-ui | 2.7.0 |
com.ly.smart-doc:smart-doc | 3.0.9 |
工作流
| 依赖 | 版本 |
|---|---|
org.flowable:flowable-spring-boot-starter | 7.1.0 |
org.flowable:flowable-spring-boot-starter-rest | 7.1.0 |
代码质量 / 测试
| 依赖 | 版本 |
|---|---|
com.guardsquare:proguard-gradle | 7.6.1 |
org.testcontainers:testcontainers | 1.20.4 |
org.testcontainers:junit-jupiter | 1.20.4 |
org.testcontainers:mysql / postgresql / redis / kafka | 1.20.4 |
注意事项
Knife4j 兼容问题(当前版本)
Knife4j 4.5.0 基于 SpringDoc 2.3.0 编译,而 BOM 中 SpringDoc 为 2.7.0。getGroupConfigs() 方法返回类型在 2.7.0 中从 List 改为 Set,导致 knife4j.enable=true 时运行时报 NoSuchMethodError。
规避方案:在 application.yml 中禁用 Knife4j 自动配置,基础 Swagger UI 仍可正常访问:
knife4j:
enable: false等待 Knife4j 官方适配 SpringDoc 2.7.x 后升级。
版本查看命令
# 查看 BOM 管理的所有依赖版本
./gradlew :nebula-support-dependencies:printVersions
# 查看根项目关注的核心版本
./gradlew dependencyVersions