我正在使用Gradle构建Android库项目并将其作为aar部署到Maven存储库。POM与Gradle缺少Android库依赖关系
图书馆具有一定的相关性,这应包括在POM
随着apply plugin: 'maven'
没有POM文件不存在,只是产生一个POM文件中的神器
随着apply plugin: 'maven-publish'
,但不包括任何依赖关系
任何想法?这只是不支持?
摇篮2.2和Android摇篮插件1.1.0
第一种方法:
configurations {
archives {
extendsFrom configurations.default
}
}
afterEvaluate { project ->
uploadArchives {
configuration = configurations.archives
repositories {
mavenDeployer {
repository(url: "http://nexus-url") {
authentication(userName: nexusUsername, password: nexusPassword)
pom.groupId = 'com.example'
pom.version = '123-SNAPSHOT'
pom.artifactId = 'foo'
pom.packaging = 'aar'
pom.project {
artifactId = 'bar'
packaging 'aar'
description 'baz'
}
}
}
}
也试过它没有afterEvaluate
第二条本办法包裹它:
更新
问题的根本原因是该项目使用了口味。如果不使用香精apply plugin: 'maven'
为了避免出现异常,最好将'configurations.compile.allDependencies.each'替换为'configurations.compile.allDependencies.withType(ModuleDependency)'。你使用'compile fileTree(dir:'libs',include:['* .jar'])'' – 2017-10-26 14:25:21