わかりましたので、ここで説明されている正確な問題が発生しています。
Gradle を使用した POM に Android ライブラリの依存関係がない
次のように、提供された回答をgradleファイルにコピーしました。
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')
}
}
}
}
}
ただし、publishToMavenLocal を実行しようとするとエラーが発生しますが、その理由がわかりません。
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)
注: 136 行目は次の行です。
configurations.compile.allDependencies.each { ModuleDependency dp ->