|
|
|
// Maven side of things
|
|
|
|
subprojects {
|
|
|
|
apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
|
|
|
|
apply plugin: 'signing'
|
|
|
|
|
|
|
|
if (gradle.startParameter.taskNames.contains("uploadMavenCentral")) {
|
|
|
|
signing {
|
|
|
|
required true
|
|
|
|
sign configurations.archives
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
task signArchives {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
|
|
|
|
*/
|
|
|
|
task uploadMavenCentral(type:Upload) {
|
|
|
|
configuration = configurations.archives
|
|
|
|
dependsOn 'signArchives'
|
|
|
|
doFirst {
|
|
|
|
repositories.mavenDeployer {
|
|
|
|
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
|
|
|
|
|
|
|
|
// To test deployment locally, use the following instead of oss.sonatype.org
|
|
|
|
//repository(url: "file://localhost/${rootProject.rootDir}/repo")
|
|
|
|
|
|
|
|
repository(url: 'http://oss.sonatype.org/services/local/staging/deply/maven2/') {
|
|
|
|
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prevent datastamp from being appending to artifacts during deployment
|
|
|
|
uniqueVersion = false
|
|
|
|
|
|
|
|
// Closure to configure all the POM with extra info, common to all projects
|
|
|
|
pom.project {
|
|
|
|
parent {
|
|
|
|
groupId 'org.sonatype.oss'
|
|
|
|
artifactId 'oss-parent'
|
|
|
|
version '7'
|
|
|
|
}
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name 'The Apache Software License, Version 2.0'
|
|
|
|
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
distribution 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|