Publish 3rd party lib with custom pom file using maven-publish

I would like to publish 3rd party library like guava from mavenCentral repo to our private Artifactory. Guava has custom pom file that contains specific data and no groupId (groupId is in parent). Gradle is not able to use custom pom for publication and if I replace generated pom-default.xml file, it results in error “supplied groupId does not match POM file”. Is there any option to solve my problem using maven-publish plugin?

configurations {
dependencies {
    lib(group: '', name: 'guava', version: '19.0')
repositories {
def libFile = configurations.lib.singleFile
def pomFile = <some magic to get pom file>
def pomFileReader = new XmlSlurper().parse(pomFile)
publishing.publications.create("${}", MavenPublication) {
			artifact libFile
			artifact source: sourcesFile, classifier: 'sources'
			groupId = "${pomFileReader.groupId}"?:pomFileReader.parent.groupId
			version = "${pomFileReader.version}"?:pomFileReader.parent.version
			artifactId = pomFileReader.artifactId
<additional copy task to replace pom-default.xml with pomFile>