I have a Gradle project I\'m using the maven-publisher plugin to install my android library to maven local and a maven repo.
That works, but the g
I was using the maven-publish
plugin for publishing my aar
dependency and actually I could not use the maven
task in my case. So I used the mavenJava
task provided by the maven-publish
plugin and used that as follows.
apply plugin 'maven-publish'
publications {
mavenAar(MavenPublication) {
from components.android
}
mavenJava(MavenPublication) {
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the api dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.api.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
I hope that it helps someone who is looking for help on how to publish the aar
along with pom
file using the maven-publish
plugin.