Update 10.1.2. Gradle installation.md
parent
e33f754ce1
commit
9a8d90e215
|
@ -0,0 +1,41 @@
|
|||
### 10.1.2. Gradle安装
|
||||
|
||||
Spring Boot兼容Gradle 1.12或更高版本。如果没有安装Gradle,你可以参考[www.gradle.org](http://www.gradle.org/)上的指南。
|
||||
|
||||
Spring Boot依赖可以使用`org.springframework.boot` `group`来声明。通常,你的项目将声明一个或多个[“Starter POMs”](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-starter-poms)依赖。Spring Boot提供一个用于简化依赖声明和创建可执行jars的有用的[Gradle插件](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#build-tool-plugins-gradle-plugin)。
|
||||
|
||||
**注**:当你需要构建一个项目时,Gradle Wrapper提供一个获取Gradle的漂亮方式。它是一个伴随你的代码一块提交的小脚本和库,用于启动构建进程。具体参考[Gradle Wrapper](www.gradle.org/docs/current/userguide/gradle_wrapper.html)。
|
||||
|
||||
下面是一个典型的`build.gradle`文件:
|
||||
```gradle
|
||||
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.3.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")
|
||||
}
|
||||
|
||||
```
|
Loading…
Reference in New Issue