From aa215941b2acc482f632214592f6fdceaf657533 Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Thu, 11 Jun 2015 05:21:51 -0700 Subject: [PATCH] fixed publication to artifactory --- libs/publish.gradle | 72 +++++++++++++++++++++++++++------------------ libs/sign.gradle | 8 ++--- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/libs/publish.gradle b/libs/publish.gradle index be50ce3..56851e5 100644 --- a/libs/publish.gradle +++ b/libs/publish.gradle @@ -1,42 +1,65 @@ // include this file in subprojects: // apply from: rootProject.file('libs/publish.gradle') +apply plugin: 'maven' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.jfrog.bintray' def thisProject = project -install.repositories.mavenInstaller.pom*.whenConfigured { pom -> - pom.project { - name thisProject.name - packaging 'jar' - description thisProject.description - url thisProject.project_website +def configurePom = { + resolveStrategy = Closure.DELEGATE_FIRST + name thisProject.name + packaging 'jar' + description thisProject.description + url thisProject.project_website + + scm { + url thisProject.project_scm + connection thisProject.project_scm + developerConnection thisProject.project_scm + } - scm { - url thisProject.project_scm - connection thisProject.project_scm - developerConnection thisProject.project_scm + licenses { + license { + name thisProject.license + url thisProject.license_url + distribution 'repo' } + } - licenses { - license { - name thisProject.license - url thisProject.license_url - distribution 'repo' - } + developers { + developer { + id thisProject.developerId + name thisProject.developerName } + } +} - developers { - developer { - id thisProject.developerId - name thisProject.developerName +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + pom.withXml { + asNode().children().last() + configurePom } } } } +install.repositories.mavenInstaller.pom*.whenConfigured { pom -> + pom.project { + name thisProject.name + configurePom.rehydrate(delegate, owner, thisObject).call() + } +} + +artifactoryPublish { + dependsOn { project.tasks.generatePomFileForMavenJavaPublication } + publications 'mavenJava' +} + bintray { user = project.bintrayUser key = project.bintrayKey @@ -53,12 +76,3 @@ bintray { bintrayUpload.dependsOn assemble bintrayUpload.finalizedBy parent.tasks.bintraySign - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } -} - diff --git a/libs/sign.gradle b/libs/sign.gradle index 885a493..038802f 100644 --- a/libs/sign.gradle +++ b/libs/sign.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'org._10ne.gradle:rest-gradle-plugin:0.1.1' + classpath 'org._10ne.gradle:rest-gradle-plugin:0.3.2' } } @@ -22,8 +22,8 @@ if( !hasProperty( 'bintrayUser' ) ) if( !hasProperty( 'bintrayKey' ) ) ext.bintrayKey = '' -if( !hasProperty( 'keyPhrase' ) ) - ext.keyPhrase = '' +if( !hasProperty( 'bintrayKeyPhrase' ) ) + ext.bintrayKeyPhrase = '' task bintraySign(type: RestTask) { description 'Push to bintray and sign it.' @@ -31,7 +31,7 @@ task bintraySign(type: RestTask) { uri = "https://api.bintray.com/gpg/${project.developerId}/maven/${project.projectId}/versions/${project.version}" username = project.bintrayUser password = project.bintrayKey - requestBody = [ passphrase: project.keyPhrase ] + requestBody = [ passphrase: project.bintrayKeyPhrase ] contentType = ContentType.JSON }