As already written on stackoverflow (well, had to update the answer after looking into details again): At the project p6spy we use 2 different plugins for publishing:
- snapshots and release publishing (using com.jfrog.artifactory) and
- bintray-related activities (using com.jfrog.bintray) in gradle.
Published:
Relevant parts from the build.gradle file follow, please note the specifics of the project:
plugins {
...
id 'com.jfrog.bintray' version '1.7.3'
id 'com.jfrog.artifactory' version '4.5.2'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
groupId project.group
artifactId project.archivesBaseName
version project.version
...
pom {
packaging 'jar'
withXml {
asNode().children().last() + {
def builder = delegate
builder.name project.name
builder.description description
builder.url 'https:
builder.licenses {
builder.license {
builder.name 'The Apache Software License, Version 2.0'
builder.url 'http:
builder.distribution 'repo'
}
}
builder.scm {
builder.url 'http:
builder.connection 'scm:git:git:
builder.developerConnection 'scm:git:ssh:
}
builder.developers {
builder.developer {
builder.name 'Quinton McCombs'
builder.email 'quinton.mccombs@gmail.com'
}
builder.developer {
builder.name 'Peter Butkovic'
builder.email 'butkovic@gmail.com'
}
builder.developer {
builder.name 'Felix Barnsteiner'
builder.email 'felix.barnsteiner@isys-software.de'
}
}
builder.issueManagement {
builder.system 'github'
builder.url 'https:
}
builder.ciManagement {
builder.system 'Travis CI'
builder.url 'https:
}
}
}
}
}
}
}
artifactory {
contextUrl = 'https:
resolve {
repository {
repoKey = 'libs-release'
}
}
publish {
repository {
if (project.version.endsWith("-SNAPSHOT")) {
repoKey = 'oss-snapshot-local'
} else {
repoKey = 'oss-release-local'
}
username = System.getenv('BINTRAY_USER')
password = System.getenv('BINTRAY_API_KEY')
}
defaults {
publications 'maven'
properties = [ 'bintray.repo': 'p6spy/maven', 'bintray.package': 'p6spy:p6spy', 'bintray.version': project.version.toString() ]
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')
publications = ['maven']
pkg {
repo = 'maven'
name = 'p6spy:p6spy'
userOrg = group
desc = description
websiteUrl = 'https:
issueTrackerUrl = 'https:
vcsUrl = 'https:
licenses = ['Apache-2.0']
publicDownloadNumbers = true
githubRepo = 'p6spy/p6spy'
githubReleaseNotesFile = 'docs/releasenotes.md'
version {
released = new Date()
name = project.version
vcsTag = "p6spy-${project.version}"
mavenCentralSync {
sync = true close = '1' user = System.getenv('SONATYPE_USERNAME') password = System.getenv('SONATYPE_PASSWORD') }
}
}
}
The goal for us was:
- fully automated snapshot as well as release publishing,
- automated maven-central sync and
- non-CI-specific solution (gradle does all the stuff => can run on travis/anywhere else).
Btw. signing of artifacts was not required to be done on our side, bintray did the job for us, the only thing we had to do was running the right gradle tasks (see .travis.yml):
- for snapshot publishing:
./gradlew artifactoryPublish --info --stacktrace
- for release publishing:
./gradlew artifactoryPublish bintrayUpload --info --stacktrace
|