参考文章
lib包gradle修改
plugins {
id 'com.android.library'
}
apply plugin: 'maven'
//上传到Maven仓库的task
uploadArchives{
repositories{
mavenDeployer{
repository(url: "http://xxxx:端口号/repository/仓库名称/") {//
authentication(userName: "填写账户", password: "填写密码")//设置用户名密码
}
pom.groupId = "com.xxx.httpdemo"
pom.artifactId = "androidlib"
pom.version = "1.0.0"
//最后引入的效果是这样的
//implementation 'com.xxx.httpdemo.androidlib:1.0.0@aar'
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}
android {
.....
}
上传aar
上传方式.jpg
重要!上传包,是需要赋予上传权限的
赋予仓库权限
xxxxx-maven2-maven-release-add
xxxxx-maven2-maven-release-edit
赋予用户权限
maven-release.deploy
访问上传的包
根gradle修改
allprojects {
repositories {
jcenter()
maven{
//私有maven仓库路径
url '域名:端口/repository/仓库名/'
credentials{//设置账户密码
username '填写账户'
password '填写密码'
}
}
}
}
单独上传aar或jar包
注意,有可能你当前登录的账号权限不够,你可以拿admin的超级权限去上传
单独上传aar_jar_0.jpg
1618885689(1).jpg
上传成功后,记得使用 com.gxx.payutils.libs:sande:3.0.0@aar 这种格式的
上传遇到错误信息
Warning: there were 1 classes in incorrectly named files.
You should make sure all file names correspond to their class names.
The directory hierarchies must correspond to the package hierarchies.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
If you don't mind the mentioned classes not being written out,
you could try your luck using the '-ignorewarnings' option.
解决办法就是将混淆关闭
nexus 405 http method put is not supported by this url
你填写的url地址错误
手动上传的aar/jar包到私有仓库,导致aar/jar文件不可以下载。从错误的信息上来看,是pom文件访问不了
- http://nexus.gxx.cn/repository/maven-releases/com/xx/push/libs/huawei/1.0.0/huawei-1.0.0.pom
- https://dl.google.com/dl/android/maven2/com/wjxls/push/libs/huawei/1.0.0/huawei-1.0.0.pom
- https://jcenter.bintray.com/com/wjxls/push/libs/huawei/1.0.0/huawei-1.0.0.pom
1609330465.jpg