Gradle error Could not find dependencyManagement () method

Below is my 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')
}

I used Gradle 2.14 and got the error below

> 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

Then I upgraded Gradle to 3.4 as indicated in the error message.

Now I get the error below

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

Is the method dependencyManagement()no longer available in Gradle 3.4? If anyone knows of an alternative method to be used in Gradle 3.4, please return

+13
source share
1 answer

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

.

+19

Source: https://habr.com/ru/post/1685658/


All Articles