Skip to content

Commit

Permalink
fixed publication to artifactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Hihlovskiy committed Jun 11, 2015
1 parent 7b999d4 commit aa21594
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 33 deletions.
72 changes: 43 additions & 29 deletions libs/publish.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -53,12 +76,3 @@ bintray {

bintrayUpload.dependsOn assemble
bintrayUpload.finalizedBy parent.tasks.bintraySign

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

8 changes: 4 additions & 4 deletions libs/sign.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand All @@ -22,16 +22,16 @@ 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.'
httpMethod = 'post'
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
}

0 comments on commit aa21594

Please sign in to comment.