Ok, so I am having the exact issue as described here:
Android library dependencies missing from POM with Gradle
I copied the provided answer to my gradle file as follows:
publishing {
publications {
mavenAar(MavenPublication) {
groupId group
artifactId 'exampleId'
version version
artifact source: file('build/outputs/aar/example-release.aar')
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
// for dependencies and exclusions
def dependenciesNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each { ModuleDependency dp ->
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dp.group)
dependencyNode.appendNode('artifactId', dp.name)
dependencyNode.appendNode('version', dp.version)
// for exclusions
if (dp.excludeRules.size() > 0) {
def exclusions = dependencyNode.appendNode('exclusions')
dp.excludeRules.each { ExcludeRule ex ->
def exclusion = exclusions.appendNode('exclusion')
exclusion.appendNode('groupId', ex.group)
exclusion.appendNode('artifactId', ex.module)
}
}
}
}
}
}
repositories {
mavenLocal()
maven {
url selectDeploymentURL()
if ( project.hasProperty( 'nexusUser' ) ) {
credentials {
username project.getProperty('nexusUser')
password project.getProperty('password')
}
}
}
}
}
However I am getting an error when attempting to publishToMavenLocal, and I'm not sure why?
FAILURE: Build failed with an exception.
* Where:
Build file 'path/build.gradle' line: 136
* What went wrong:
Execution failed for task ':example:generatePomFileForMavenAarPublication'.
> Could not apply withXml() to generated POM
> No signature of method: build_42xq5bsii69isvukzktk1oy51$_run_closure5_closure19_closure21_closure23_closure24.doCall() is applicable for argument types: (org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency_Decorated) values: [org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency_Decorated@433edba9]
Possible solutions: doCall(org.gradle.api.artifacts.ModuleDependency), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
Note: Line 136 is this line:
configurations.compile.allDependencies.each { ModuleDependency dp ->
compile
withimplementation
orapi
– Conservation