apply plugin: ‘maven‘
uploadArchives{
    repositories.mavenDeployer{
        // 本地仓库路径
        repository(url:"file://C://Users/gang/.m2/repository/")
        // 唯一标识 包名
        pom.groupId = "com.xxx.xxxx"
        // 项目名称
        pom.artifactId = "LibTranFormEngineCore"
        // 版本号
        pom.version = "1.0.1"
    }
}

点击即可上传
buildscript {
    repositories {
        mavenLocal() //添加本地maven仓库
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        //添加仓库的依赖
    }
}
原文:https://www.cnblogs.com/gregpeng/p/14613778.html