I have to convert my build to publish to Sonatype. I’m using the maven and signing plugins. This is a multiple-artifact/multiple-classifier project.
I see that all of the .asc signature files get created (locally), but for some reason only the POM’s .asc file gets uploaded. Seems to me that the plugins should realize that if I am building a “hsqldb” jar artifact, and it even generates the .asc file for the jar, that it should know to upload the corresponding .asc file. Maybe I have to tell something explicitly because of multiple-classifier or multiple-project? Here is the relevant Gradle uploadArchives code:
uploadArchives {
def authMap = [:]
if (project.hasProperty(‘mavenRepository.dest.username’))
authMap[‘userName’] = project.property(‘mavenRepository.dest.username’)
if (project.hasProperty(‘mavenRepository.dest.password’))
authMap[‘password’] = project.property(‘mavenRepository.dest.password’)
if (project.hasProperty(‘mavenRepository.dest.privateKey’))
authMap[‘privateKey’] =
project.property(‘mavenRepository.dest.privateKey’)
repositories.mavenDeployer {
configuration = configurations.deployJars
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
if (project.hasProperty(‘mavenRepository.dest.url’))
repository(url: project.property(‘mavenRepository.dest.url’)) {
authentication(authMap)
}
[
addFilter(‘hsqldb’) {artifact, file -> artifact.name == ‘hsqldb’},
addFilter(‘sqltool’) {artifact, file -> artifact.name == ‘sqltool’}
].each { pom -> pom.project {
// The hasProperty tests are necessary even for required variables
// because this code is evaluated even if the uploadArchives task
// will never be executed.
if (project.hasProperty(‘title’)) name project.property(‘title’)
if (project.hasProperty(‘description’))
description project.property(‘description’)
if (project.hasProperty(‘url’)) url project.property(‘url’)
if (project.hasProperty(‘inceptionYear’))
inceptionYear project.property(‘inceptionYear’)
scm {
if (project.hasProperty(‘scm.url’))
url project.property(‘scm.url’)
if (project.hasProperty(‘scm.connection’))
connection project.property(‘scm.connection’)
if (project.hasProperty(‘scm.tag’))
tag project.property(‘scm.tag’)
}
if (project.hasProperty(‘org.name’)
|| project.hasProperty(‘org.url’)) organization {
if (project.hasProperty(‘org.name’))
name project.property(‘org.name’)
if (project.hasProperty(‘org.url’))
url project.property(‘org.url’)
}
licenses {
license {
name ‘HSQLDB License, a BSD open source license’
url ‘http://hsqldb.org/web/hsqlLicense.html’
distribution ‘repo’
}
}
if (project.hasProperty(‘developer.name’)
|| project.hasProperty(‘developer.email’)) developers {
developer {
if (project.hasProperty(‘developer.id’))
id project.property(‘developer.id’)
if (project.hasProperty(‘developer.name’))
name project.property(‘developer.name’)
if (project.hasProperty(‘developer.email’))
email project.property(‘developer.email’)
}
}
} }
}
}