下面是我的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