之前使用的是maven插件,导致自己的sdk 引用其他远程aar库,找不到类
后期换成maven-publish就解决了
apply plugin: 'maven-publish'
def POM_VERSION = '1.0.22'
def POM_ARTIFACTID = "downloadLibrary"//项目名称id
def POM_GROUPID = 'xxxx' //项目组id
def POM_DESCRIPTION = 'arr for Android'
def NEXUS_USERNAME = 'xxxx' //用户名
def NEXUS_REPOSITORY_URL = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' //repository的URL
//发布前先执行 clean, 避免发布的 aar 中使用了旧的缓存代码
publish.dependsOn clean
//兼容老的 uploadArchives task 来执行 aar 发布
uploadArchives.dependsOn publish
afterEvaluate {
publishing {
publications {
C01(MavenPublication) {
artifactId = POM_ARTIFACTID
from components.xxxRelease
version POM_VERSION
groupId POM_GROUPID
description POM_DESCRIPTION
}
}
repositories {
maven {
credentials {
username NEXUS_USERNAME
password getNexusPassword()
}
url = NEXUS_REPOSITORY_URL
}
}
}
}
def getNexusPassword() {
File file = project.rootProject.file('local.properties');
if (file.exists()) {
Properties properties = new Properties()
properties.load(file.newDataInputStream())
return properties.getProperty('NEXUS_PASSWORD')
}
return ''
}