Hi, on a KMP project I want to configure dependenc...
# multiplatform
e
Hi, on a KMP project I want to configure dependency and this code compile:
Copy code
kotlin {
    sourceSets {
        val commonMain by getting {
            dependencies {
                api("group:artifact:version") {
                    because("...")
                    exclude(group = "...")
                }
When I use version catalog (ex:
api(libs.libraryInCatalag) {
) it's not compiling:
Copy code
Line 21:                 api(libs.libraryInCatalag) {
                               ^ Type mismatch: inferred type is Provider<MinimalExternalModuleDependency!>! but String was expected
How to configure a dependency coming for a version catalog?
t
Better to use https://kotlinlang.org/docs/whatsnew2220.html#new-approach-for-declaring-common-dependencies In your particular case - use
api(libs.libraryInCatalog.get())
e
Ah, we're not yet on 2.2.20. I'll try once we update. If I try
Copy code
api(libs.libraryInCatalag.get()) {
    because("")
}
I get
Copy code
Minimal dependencies are immutable.
libs.libraryInCatalag.get().toString()
passes 🤔
t
KT-73663 Gradle: Version catalog accessors are not configurable in dependency blocks