我正在使用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