创建属于自己的私用android仓库

来源:互联网 发布:视频剪辑器mac 编辑:程序博客网 时间:2024/05/21 19:26
1.在项目的build.gradle下添加


    allprojects {
         repositories {
          jcenter()
           //使用自己的仓库
          mavenLocal()
     }
     
2.在library下添加


    uploadArchives {
    repositories.mavenDeployer {
        /*url指定仓库路径*/
        repository(url: "创建私有仓库的url") {
            authentication(userName: "username", password: "password")
        }
        /*版本*/
        pom.version = "版本号"
        pom.artifactId = "artifactId"
        pom.groupId = "groupId"
    }
    }
3.在gradlle下(android studio右边侧栏)找到library下的upload双击uploadArchives,此时已经构建完毕


### 使用私用仓库


  在项目的build下添加
  
    allprojects {
    repositories {
        maven {
            url "创建私有仓库的url"
        }
    }
}


在dependencies下引用


     compile 'groupId:artifactId:版本号'
0 0