🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 10.1.2. Gradle安装 Spring Boot兼容Gradle 1.12或更高版本。如果本地没有安装Gradle,你可以参考[www.gradle.org](http://www.gradle.org/)上的指南。 Spring Boot的依赖可通过groupId `org.springframework.boot`来声明。通常,你的项目将声明一个或多个[“Starter POMs”](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/III.%20Using%20Spring%20Boot/13.4.%20Starter%20POMs.md)依赖。Spring Boot提供了一个很有用的[Gradle插件](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/VIII.%20Build%20tool%20plugins/59.%20Spring%20Boot%20Gradle%20plugin.md),可以用来简化依赖声明,创建可执行jars。 **注**:当你需要构建项目时,Gradle Wrapper提供一种给力的获取Gradle的方式。它是一小段脚本和库,跟你的代码一块提交,用于启动构建进程,具体参考[Gradle Wrapper](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/II.%20Getting%20started/www.gradle.org/docs/current/userguide/gradle_wrapper.html)。 下面是一个典型的`build.gradle`文件: ```text buildscript { repositories { jcenter() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT") } } apply plugin: 'java' apply plugin: 'spring-boot' jar { baseName = 'myproject' version = '0.0.1-SNAPSHOT' } repositories { jcenter() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } } dependencies { compile("org.springframework.boot:spring-boot-starter-web") testCompile("org.springframework.boot:spring-boot-starter-test") } ```