Update 13.2. Gradle.md
parent
877d8c8559
commit
7e7b4e5c88
|
@ -0,0 +1,29 @@
|
|||
### 13.2. Gradle
|
||||
|
||||
Gradle用户可以直接在它们的`dependencies`节点处导入”starter POMs“。跟Maven不同的是,这里没有用于导入共享配置的"超父"(super parent)。
|
||||
```gradle
|
||||
apply plugin: 'java'
|
||||
|
||||
repositories { jcenter() }
|
||||
dependencies {
|
||||
compile("org.springframework.boot:spring-boot-starter-web:1.3.0.BUILD-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
[spring-boot-gradle-plugin](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#build-tool-plugins-gradle-plugin)插件也是可以使用的,它提供创建可执行jar和从source运行项目的任务。它也添加了一个`ResolutionStrategy`用于让你省略常用依赖的版本号:
|
||||
```gradle
|
||||
buildscript {
|
||||
repositories { jcenter() }
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'spring-boot'
|
||||
|
||||
repositories { jcenter() }
|
||||
dependencies {
|
||||
compile("org.springframework.boot:spring-boot-starter-web")
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test")
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue