下面是我的build.gradle
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”上的参数。
在第3.4级中,方法dependencyManagement()不再可用吗?如果有人知道第3.4级中使用的替代方法,请回复
发布于 2017-09-14 10:25:07
要使用这个DSL,您必须提供依赖管理插件:
buildscript {
repositories {
maven {
jcenter() //or mavenCentral()
}
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
}
}
apply plugin: "io.spring.dependency-management"或者你可以使用:
plugins {
id "io.spring.dependency-management" version "1.0.3.RELEASE"
}更多细节在这里。
发布于 2021-12-11 09:51:29
对我来说,修复是将gradle-wrapper.properties中的distributionUrl替换为:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
并将build.gradle文件中的依赖项更新为:
dependencies { classpath "com.android.tools.build:gradle:7.0.4" }
发布于 2021-09-21 12:14:49
在第7级中,使用以下方法导入BOM也会导致此错误:
dependencyManagement {
imports {
mavenBom "tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}"
}
}在第7级中,您需要以以下方式导入BOM:
implementation platform("tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}")https://stackoverflow.com/questions/46214689
复制相似问题