Georg Heiler
Georg Heiler

Reputation: 17724

gradle kotlin DSL extendsfrom

How can I reformulate:

testCompile.extendsFrom compileOnly

of the Gradle Groovy DSL to its Kotlin-based equivalent?

configurations {
        testCompile{
            extendsFrom(compileOnly)
        }
    }

My approach above fails.

Upvotes: 4

Views: 3246

Answers (3)

pixel
pixel

Reputation: 26513

if you deal with custom tasks or test suites, you can call:

configurations {
    val integrationTestImplementation by getting {
        extendsFrom(configurations.implementation.get())
    }
}

Upvotes: 0

Stefan Haberl
Stefan Haberl

Reputation: 10559

If you want to change an already existing config use

configurations.testImplementation.get().extendsFrom(configurations.compileOnly.get())

Upvotes: 0

Georg Heiler
Georg Heiler

Reputation: 17724

configurations {
        create("testCompile").apply {
            extendsFrom(configurations.compileOnly.get())
        }
    }

https://github.com/spring-projects/spring-boot/issues/16251

Upvotes: 8

Related Questions