Skip to content

Instantly share code, notes, and snippets.

@robints
Last active June 21, 2017 03:14
Show Gist options
  • Save robints/6efd6d50d2c6f0cd36ecdc2ffa93bc8a to your computer and use it in GitHub Desktop.
Save robints/6efd6d50d2c6f0cd36ecdc2ffa93bc8a to your computer and use it in GitHub Desktop.
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
def packageName = "${groupId}"
def libraryVersion = "${version}"
def libraryName = "${artifactId}"
def artifactorySnapshotContextUrl = "${artifactorySnapshotContextUrl}"
def artifactoyReleaseContenxtUrl = "${artifactoyReleaseContenxtUrl}"
def artifactoryRepoKey = "${artifactoryRepoKey}"
def artifactoryUsername = "${artifactoryUsername}"
def artifactoryPassword = "${artifactoryPassword}"
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version libraryVersion
artifactId libraryName
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
}
artifactory {
if(project.version.endsWith('-SNAPSHOT')) {
contextUrl = artifactorySnapshotContextUrl
}else {
contextUrl = artifactoyReleaseContenxtUrl
}
publish {
repository {
// The Artifactory repository key to publish to
repoKey = artifactoryRepoKey
username = artifactoryUsername
password = artifactoryPassword
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team': 'core']
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
artifactoryPublish.dependsOn assembleRelease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment