Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
apply plugin: 'maven-publish'
publishing {
publications {
aar(MavenPublication) {
setGroupId 'com.swarawan'
artifactId project.getName()
version libraryVersion
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
if (it.moduleGroup == 'com.android.databinding' || it.moduleVersion == 'unspecified') {
println("ignoring dependency ${it.moduleGroup}:${it.moduleName}:${it.moduleVersion}")
return;
}
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
println(it.moduleGroup)
println(it.moduleVersion)
println(it.moduleName)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment