gpt4 book ai didi

gradle - gradle错误找不到方法dependencyManagement()

转载 作者:行者123 更新时间:2023-12-03 23:27:59 25 4
gpt4 key购买 nike

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

现在我得到以下错误

Could not find method dependencyManagement() for arguments [build_79bcact4bkf1 sckkod1j3zl7l$_run_closure1@4a2d71c9] on root project 'myproject' of type org.gradle.api.Project.



gradle 3.4中不再提供 dependencyManagement()方法吗?
如果有人知道在gradle 3.4中使用的替代方法,请还原

最佳答案

要使用此DSL,您必须提供dependency-management-plugin:

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"
}

更多 details here.

关于gradle - gradle错误找不到方法dependencyManagement(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46214689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com