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
} }