hi, I wanted to exclude a transitive dependency in...
# multiplatform
j
hi, I wanted to exclude a transitive dependency in one of the platforms dependencies im my gradle configuration, but I get the error message
Could not find method api() for arguments [project ':...', build_ckdfo2mkuty2268dk8wzojs1m$_run_closure1$_closure2$_closure4$_closure5@5af0b522] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler.
any clues?
Copy code
kotlin {
    sourceSets {
        commonTest.dependencies {
            api (project("…")) {
                exclude group: "…", module: "…"
            }
        }
    }
}
m
You cannot
{ … }
on project dependencies
You can probably do something similar (example in Kotlin, no idea about Groovy):
Copy code
api(project("…").apply {
  exclude("…", "…")
})
j
thanks @Marc Knaup, I tried that by switching to kotlin syntax, which I avoided as the groovy syntax is a bit cleaner, but the error messages are a lot cleaner then the groovy errors… syntactically there is no error, but the exclusion seams not to work, its still in the classpath…
m
That is either a bug then or unsupported 😕 In both cases it makes sense to report on YouTrack.
I find the Kotlin syntax cleaner because it's easier to reason about what's happening. Groovy while shorter has much more magic involved.
j
thanks 🙂