I'm trying to publish an Android library to a local JFrog Artifactory. Currently I have this:
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'com.android.library'
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/app-beta-debug.aar")
}
}
}
artifactory {
contextUrl = 'http://localhost:8081/artifactory'
publish {
repository {
repoKey = 'libs-release-local'
username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}
I have skipped some parts like android and dependencies sections for brevity. The build.gradle has multiple compile dependencies.
gradle artifactoryPublish
published the artifact to Artifactory but the generated pom doesn't have the dependencies. I found this answer: https://stackoverflow.com/a/30523571/2829308
from this answer, pom.withXml
worked (although I couldn't figure out how to exclude a dependency). But this seems hackish. I feel like there should be a better way available. I tried using the uploadArchives
way as follows
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://localhost:8081/artifactory/libs-release-local")
pom.version = libraryVersion
pom.artifactId = libraryArtifactId
pom.groupId = libraryGroupId
}
}
}
It says task successful but artifact doesn't get published in Artifactory. Am I missing something obvious? How do I fix this?