Skip to content

Instantly share code, notes, and snippets.

@tonisives
Created May 19, 2020 05:32
Show Gist options
  • Save tonisives/17b23a867e6ed6631d593c2e25bc8d0f to your computer and use it in GitHub Desktop.
Save tonisives/17b23a867e6ed6631d593c2e25bc8d0f to your computer and use it in GitHub Desktop.
if (project.hasProperty("hmArtifactoryUrl")) {
apply plugin: "maven"
apply plugin: "com.jfrog.artifactory"
apply plugin: 'com.jfrog.bintray'
def artifact = new Properties()
artifact.load(new FileInputStream("$projectDir/deploy.settings"))
// add the sources and doc artifacts
task sourcesJar(type: Jar) {
from sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
archives javadocJar
archives sourcesJar
}
// artifactory
artifactory {
contextUrl = hmArtifactoryUrl
publish {
repository {
repoKey = project.hasProperty("repo") ? project.property("repo") : artifact.repo
username = hmArtifactoryPublishUser
password = hmArtifactoryPublishPassword
}
defaults {
publishConfigs('archives', 'published')
publishIvy = false
}
}
}
// bintray
install {
repositories.mavenInstaller {
pom.project {
packaging 'jar'
groupId artifact.groupId
artifactId artifact.id
version artifact.version
name artifact.id // pom.project.name must be same as bintray.pkg.name
url artifact.siteUrl
inceptionYear '2018'
licenses {
license { // HARDCODED
name 'MIT'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'
}
}
scm {
connection artifact.gitUrl
developerConnection artifact.gitUrl
url artifact.siteUrl
}
}
}
}
bintray {
user = hmBintrayUser
key = hmBintrayApikey
configurations = ['archives']
pkg {
repo = "maven"
name = artifact.id
websiteUrl = artifact.siteUrl
vcsUrl = artifact.gitUrl
licenses = artifact.licenses
version {
name = artifact.version
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment