下面是我的build.gradlegradle这个错误找不到方法dependencyManagement()
buildscript {
ext {
springBootVersion = '2.0.0.M3'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'org.springframework.boot'
apply plugin: 'maven-publish'
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Brixton.SR7'
}
}
dependencies {
compile("org.springframework.cloud:spring-cloud-starter-eureka")
compile "org.elasticsearch:elasticsearch:5.5.0"
testCompile('org.springframework.boot:spring-boot-starter-test')
}
我使用gradle这个2.14,得到了下面的错误
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 3.4 or later. The current version is Gra
dle 2.14
然后我升级到gradle这个3.4的建议在错误信息中。
现在,我得到下面的错误
找不到方法dependencyManagement()为参数[build_79bcact4bkf1 sckkod1j3zl7l $ @ _run_closure1 4a2d71c9]在根项目 'MyProject的' 类型org.gradle.api.Project的 。
Gradle 3.4中的方法dependencyManagement()不再可用吗? 如果有人知道的另一种方法的gradle这个3.4中使用,请回复
这种方法确实来自gradle这个本身,而是来自春天的插件。看看这里:https://github.com/spring-gradle-plugins/dependency-management-plugin – Opal