Some elements are removed when generate a pom.xml using the maven-publish plugin

Seems like this has something to do with using XmlMarkupBuilder to define the pom content, where some of the element names are already in scope for the closure. There may be a groovy way to solve this, or you could build the pom using the XML Node API:

apply plugin: 'maven-publish'
def createPom = {
    name "Test Parent"
    url "https://test.com/"
    inceptionYear "2012"
    modules {
        module "test-library"
    }
}
publishing {
    publications {
        maven(MavenPublication) {
            artifactId "test-parent"
            pom.withXml {
                asNode().appendNode("description", "This is a test.")
                def parent = asNode().appendNode("parent")
                parent.appendNode("groupId", "org.sonatype.oss")
                parent.appendNode("artifactId", "oss-parent")
                parent.appendNode("version", "7")
                asNode().children().last() + createPom
            }
        }
    }