How to override a platform dependency version?

Hi!

So I have this platform dependency in my com.example:service Kotlin DSL project:

    implementation(platform("com.example.lib:bom:10.1"))

and inside that bom, there is the dependency:

    api("com.example.model:model:10.1")

Okay, so a transitive dependency on com.example.model:model:10.1, no problem so far, but I want to upgrade the com.example:service to depend on com.example.model:model:11.0 so I add:

   implementation("com.example.model:model:11.0")

But gradle forces the dependency to be on com.example.model:model:10.1. Okay, so problem, exclude it from the bom dependency:

    implementation(platform("com.example.lib:bom:10.1")) {
        exclude(group = "com.example.model")
    }

But I get the error:

Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Configuration.exclude(group: String? = …, module: String? = …): Configuration defined in org.gradle.kotlin.dsl

How can I solve this problem?

A platform(...) dependency does not bring in any transitive dependency, a platform(...) dependency just sets version constraints.

And unless the version constraint for model is strict, it would also only upgrade the version, not downgrade.

If it is strict, there might be a good reason why it is.

All in all, can you share a build --scan URL of the step before you tried the exclude?