How to use Artifactory to upload/deploy an Android library
In the top level build.gradle of your library project, add:
buildscript {
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
In your library module’s build.gradle, add:
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
def packageName = 'edu.njit.avatar.sharedlib'
def libraryVersion = '1.0.0'
Rename your library module’s name to match the output filename of the assembleRelease task.
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId project.getName()
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
}
artifactory {
contextUrl = 'http://your.repo.site:8081/artifactory'
publish {
repository {
repoKey = 'libs-release-local'
username = "admin"
password = "password"
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishPom = true
}
}
}
Now, run “assembleRelease” and “artifactoryPublish” gradle tasks.
In the top level build.gradle file of your application project, add this:
allprojects {
repositories {
maven { url "http://your.repo.site:8081/artifactory/libs-release-local" }
}
}
In the module’s build.gradle file, add this:
compile 'edu.njit.avatar.sharedlib:edu.njit.avatar.sharedlib:1.0.0'