Pom-files for multi-flavored android lib not published on uploadArchives-task

I am having trouble uploading my two-flavored android library to mavenCentral completely. By completely, I mean that all files are uploaded but the pom.xml files. Apart from the pom-file, each flavor is uploaded just fine (and that includes the signature-files for the pom-files) as an independent artifact, and I even can download and use them via gradle, as long as I know the dependency-parameters by heart. However, the artifacts cannot be looked up via search nor synced across the repositories, because of those missing pom-files. I have read a lot in this and other forums, but no solution actually worked out, so I am posting this question more or less “again”, because my case was never among the cases I found - or at least not with an answer.

Here’s the code I use (it’s embedded into a script-file, and uses some functions I did not provide here, you can take a look at the complete code at my github-repo of the library in question: AndroDialogs:

afterEvaluate { project ->

uploadArchives {

repositories {

mavenDeployer {

beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

credentialProps.load(new FileInputStream(credentialsPropsFile))

repository(url: getReleaseRepositoryUrl()) {

authentication(userName: credentialProps[‘NEXUS_USER’], password: credentialProps[‘NEXUS_PASSWORD’])

}

snapshotRepository(url: getSnapshotRepositoryUrl()) {

authentication(userName: credentialProps[‘NEXUS_USER’], password: credentialProps[‘NEXUS_PASSWORD’])

}

android.ext.flavors.each {

def String flavorRelease = it + ‘Release’

def String flavorName = it

addFilter(it) { artifact, file ->

artifact.attributes.classifier.contains(flavorRelease)

}

pom(it).groupId = POM_GROUP_ID

pom(it).artifactId = POM_ARTIFACT_ID + ‘-’ + it

pom(it).version = versionString

pom(it).project {

def String pomName = POM_NAME + ’ (’ + flavorName + ‘)’

name pomName

packaging POM_PACKAGING

description POM_DESCRIPTION

url POM_URL

scm {

url POM_SCM_URL

connection POM_SCM_CONNECTION

developerConnection POM_SCM_DEV_CONNECTION

}

licenses {

license {

name POM_LICENCE_NAME

url POM_LICENCE_URL

distribution POM_LICENCE_DIST

}

}

developers {

developer {

id POM_DEVELOPER_ID

name POM_DEVELOPER_NAME

}

}

}

}

}

}

}

signing {

required { isReleaseBuild() && gradle.taskGraph.hasTask(“uploadArchives”) }

credentialProps.load(new FileInputStream(credentialsPropsFile))

allprojects {

ext.‘signing.secretKeyRingFile’ = credentialProps[‘SIGNING_SECRET_KEY_RING_FILE’]

ext.‘signing.keyId’ = credentialProps[‘SIGNING_KEY_ID’]

ext.‘signing.password’ = credentialProps[‘SIGNING_PASSWORD’]

}

sign configurations.archives

} }

1 Like