gradle上传本地文件到远程maven库(nexus服务器)

自定义aar-upload.gradle文件

artifacts {
    archives file('./build/outputs/aar/Lib_ads-baidu-debug.aar')
}

uploadArchives {
    repositories {
        mavenDeployer {
            print "------------------uploadArchives"
            //本地maven
            repository(url: 'http://127.0.0.1:8081/nexus/content/repositories/thirdparty') {
                authentication(userName: 'admin', password: 'admin123')
                pom.project {
                    groupId 'ads'
                    artifactId 'lib-ads-ad360'
                    version '1.0.2'
                    packaging 'aar'
                }
            }
        }
    }
}

buile.gradle引用添加

apply plugin: 'maven'
apply from: './你自己定义的文件名.gradle'

repositories{
     maven { url "http://172.0.0.1:8081/nexus/content/repositories/thirdparty/" }  
}

脚本大家在网上都搜的到,坑爹的是有些东西说的很不清楚。

仓库分四种类型:group仓库组、hosted本地仓库、proxy代理仓库、virtual虚拟仓库

本地上传的话,只能传到hosted仓库,所以gradle脚本只能写

http://127.0.0.1:8081/nexus/content/repositories/thirdparty

其他路径都是错误的,切记!!!这破问题搞了我两天时间

参考博客:http://www.javatang.com/archives/2010/01/23/4518375.html

欢迎关注我的微信公众号:安卓圈

posted @ 2018-05-14 12:52  嘉禾世兴  阅读(1183)  评论(0编辑  收藏  举报