Cannot change dependencies of configuration ':implementation' after it has been included in dependency resolution

Viewed 1447

I have got a very basic build.gradle file.

plugins {
    id 'org.springframework.boot' version '2.2.5.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

bootJar{
    mainClassName = "$mainClassName";
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

I get the following error when bootJar task is placed before dependencies block. When placed after the dependencies block i don't get an error.

What went wrong:
A problem occurred evaluating root project 'sample-project-spring-boot'.
Cannot change dependencies of configuration ':implementation' after it has been included in dependency resolution.
0 Answers
Related