ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# 64.2 Gradle依赖管理 ### 64.2 Gradle依赖管理 `spring-boot`插件自动应用[Dependency Management Plugin](https://github.com/spring-gradle-plugins/dependency-management-plugin/),并配置它导入`spring-boot-starter-parent` bom。这提供了跟Maven用户喜欢的相似依赖管理体验,例如,如果声明的依赖在bom中被管理的话,你就可以省略版本。为了充分使用该功能,只需要想通常那样声明依赖,但将版本号设置为空: ``` dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.thymeleaf:thymeleaf-spring4") compile("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect") } ``` **注** 你声明的`spring-boot` Gradle插件的版本决定了`spring-boot-starter-parent` bom导入的版本(确保可以重复构建)。你最好将`spring-boot` gradle插件版本跟Spring Boot版本保持一致,版本详细信息可以在[附录](../X.%20Appendices/E.%20Dependency%20versions.md)中查看。 `spring-boot`插件对于没有指定版本的依赖只会提供一个版本。如果不想使用插件提供的版本,你可以像平常那样在声明依赖的时候指定版本。例如: ``` dependencies { compile("org.thymeleaf:thymeleaf-spring4:2.1.1.RELEASE") } ```