Skip to content

Commit

Permalink
Use lifecycle to add signing task
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Ryan committed Apr 10, 2012
1 parent 66332d8 commit 1df6e44
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions gradle/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ subprojects {
apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
apply plugin: 'signing'

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask("uploadMavenCentral")) {
signing {
required true
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
if (gradle.startParameter.taskNames.contains("uploadMavenCentral")) {
signing {
required true
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
}

Expand All @@ -21,7 +19,7 @@ subprojects {
*/
task uploadMavenCentral(type:Upload) {
configuration = configurations.archives
dependsOn { 'signArchives' }
dependsOn 'signArchives'
doFirst {
repositories.mavenDeployer {
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
Expand Down

0 comments on commit 1df6e44

Please sign in to comment.