Kotlin-dsl-samples: Configuration with name 'implementation' not found.

Created on 2 Dec 2018  路  5Comments  路  Source: gradle/kotlin-dsl-samples

Expected Behavior

If I am configuring subprojects' dependencies via a filter, I expect the implementation function to work.

Current Behavior

Gradle fails to build with the following message:

Configuration with name 'implementation' not found.

This happens because of the dependencies {...} block below:

// apply the proper plugins & configuration for Spring Boot subprojects
configure(subprojects.filter { project -> isSpringBootProject(project) }) {
    val springBootVersion: String by project

    apply(plugin = "org.springframework.boot")
    apply(plugin = "io.spring.dependency-management")

    val implementation by configurations

    dependencies {

        implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))

    }
}

Context

I am starting a multi project build from scratch. I want the root build script to control common dependencies so that I can minimize duplication in subproject build.gradle.kts files.

I am starting with a list of subproject names that should apply common Spring Boot plugins and dependencies. If the project is in that list, I want it to use the a common BOM as described in these docs:

implementation(platform(...))

Most helpful comment

Using Gradle 5.1 @JLLeitschuh solution was not working for me. I got this to work by adding the following:
subprojects{ apply(plugin = "java") }

All 5 comments

try
gradle subproject:build

Try:

    dependencies {

       "implementation"(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))

    }

Using Gradle 5.1 @JLLeitschuh solution was not working for me. I got this to work by adding the following:
subprojects{ apply(plugin = "java") }

The implementation configuration is registered by the java plugin. The error reports you got make sense. Good you figured it out, closing.

Somebody had the same problem on stackoverflow, and there's an example _build.gradle.kts_ that fix the issue there, leaving it here for anyone that might land on this page.

Was this page helpful?
0 / 5 - 0 ratings