This message was deleted.
# dependency-management
s
This message was deleted.
c
that code is adding the dependency while iterating through them; try adding them to an intermediate list variable, and then adding those to the configuration afterwards.
b
This gives me the same error
Copy code
val depsToAdd = configuration.dependencies.mapNotNull {
      val bom = when (group) {
        "com.squareup.okio" -> "com.squareup.okio:okio-bom:3.3.0"
        else -> return@mapNotNull  null
      }
      project.dependencies.platform(bom)
    }
    configuration.dependencies.addAll(depsToAdd)
c
hmmm. stack trace?
b
My bad I got confused with my code. The updated code doesn’t throw but it looks like it’s not applying properly? or too late. I’m getting
> Could not find com.squareup.okio:okio:.
like if the
platform
wasn’t there
I’m upgrading Gradle from 7.x to 8.1.1. Maybe something has changed which is causing me trouble
e
Copy code
dependencies {
    configurations.all {
        withDependencies {
            if (any { it.group == "com.squareup.okio" }) {
                add(create("com.squareup.okio:okio-bom:3.3.0"))
            }
        }
    }
}
b
How does it know to treat it as a
platform
?
e
oh forgot that, add it
👍 1
b
I’ll give it a try thank you
Ephemient, your code worked for me, thank you