gradle kotlin DSL extendsfrom
Asked Answered
C

3

2

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.

Cowen answered 18/6, 2020 at 14:19 Comment(0)
C
7
configurations {
        create("testCompile").apply {
            extendsFrom(configurations.compileOnly.get())
        }
    }

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

Cowen answered 18/6, 2020 at 17:2 Comment(2)
Unresolved reference: compileOnly =(Breccia
great answer. worked perfectly on Android Studio Chipmunk with Gradle 7+Diseur
A
0

If you want to change an already existing config use

configurations.testImplementation.get().extendsFrom(configurations.compileOnly.get())
Acth answered 16/12, 2022 at 15:39 Comment(0)
D
0

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

configurations {
    val integrationTestImplementation by getting {
        extendsFrom(configurations.implementation.get())
    }
}
Dictator answered 28/6 at 9:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.