Any way to use existing pom.xml when using maven plugin?

I’ve got a number of dependencies that have transitive=true in my project. As per GRADLE-1574, that means that the pom is not getting generated correctly when I use the install/uploadArchives tasks. I realize that I can manipulate the pom manually by adding a pom.whenConfigured closure, but properly excluding all of the transitive dependencies is more logic than I want to include in my build.gradle.

I’ve got a way to generate a proper pom, with all transitive dependencies excluded, but it’s not something I can use as part of the gradle pom generation logic. Is there a way I can tell the maven plugin to use a pom at a location I specify rather than generate its own?

One way is to implement the POM rewriting in a generic way. Another is to use pom.withXml() to replace the POM’s content with your own. Something like this:

pom.withXml { provider ->
  def builder = provider.asString()
  builder.length = 0 // delete existing content
  builder.append(file("path/to/pom.xml").text)
}