【发布时间】:2018-05-26 11:05:18
【问题描述】:
在一个 Maven 项目中,我有标签:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
Gradle 的语法是什么?
这是我目前的 build.gradle。我认为这需要添加到构建脚本中,也许会替换我目前拥有的。如果可能,请解释为什么我需要添加它。我正在尝试将 pom.xml 转换为 gradle。
buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
}
}
plugins {
id 'org.springframework.boot' version '1.5.9.RELEASE'
id 'java'
}
repositories {
mavenCentral()
}
/*Runtime dependencies*/
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile("io.springfox:springfox-swagger2:2.6.1")
compile("io.springfox:springfox-swagger-ui:2.6.1")
compile('org.springframework.boot:spring-boot-starter')
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-data-rest")
}
【问题讨论】:
-
你想从父母那里继承什么?特性?依赖管理?通用配置?可以使用 Gradle 在一个地方声明所有这些,而无需继承。
-
我不需要任何具体的东西。我更担心我会错过
starter-parent提供的某些依赖项。我的担心是由于没有满足依赖关系,但事实证明这不是问题(已修复)。然而,约翰的回答消除了我的一个很大的疑问。
标签: maven spring-boot gradle