Virtual platforms, publishing, and transitive resolution problems

The pom.withXml workaround is really messy to do in a Kotlin build plugin also, as its using Groovy XML and duck-typing… found this related issue but argh, I feel like I’m going down a time-wasting rabbit hole here: https://github.com/gradle/kotlin-dsl/issues/225.

UPDATE: Here is the equivalent Kotlin code, which requires the kotlinx.dom dependency:

pom.withXml {
    it.asElement()
    .firstChildElement("dependencyManagement")
    ?.firstChildElement("dependencies")
    ?.elements("dependency")
    ?.filter { dep ->
        dep.firstChildElement("groupId")?.textContent == "com.fasterxml.jackson" &&
        dep.firstChildElement("artifactId")?.textContent == "jackson-platform" &&
        dep.firstChildElement("scope")?.textContent == "import"
    }
    ?.forEach { node -> node.removeFromParent() }
}