Android使用私服加速构建教程

私服Nexus地址

  • Nexus Repository Manager
  • 账号/密码:android/1111

私服简介

私服是架设在局域网的一种特殊的远程仓库,目的是代理远程仓库及部署第三方构件。有了私服之后,当 Maven 需要下载构件时,直接请求私服,私服上存在则下载到本地仓库;否则,私服请求外部的远程仓库,将构件下载到私服,再提供给本地仓库下载

加速方法.

  1. 在根目录build.gradle加入私服地址
 repositories {
        //jcenter()
        maven {
            url 'http://172.16.22.18:8081/repository/maven-public/'
        }
}

allprojects {
    repositories {
        //jcenter()
        maven {
            url 'http://172.16.22.18:8081/repository/maven-public/'
        }
    mavenCentral()
    }
}
  1. 阿里云的可以去掉了.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "config.gradle"

buildscript {

    ext.kotlin_version = '1.3.31'
    ext.anko_version = '0.10.5'

    repositories {//这里是上传maven用到的仓库地址
        //jcenter()
        maven {
            url 'http://172.16.22.18:8081/repository/maven-public/'
        }
        /*maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }*/
        google()
        maven {
            url 'https://dl.bintray.com/tianjianshi1989/maven/'
        }
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.2'
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
        classpath 'com.tianjianshi1989.maven:gradle-config-plugin:0.0.4'
        classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
        classpath 'com.tencent.bugly:symtabfileuploader:2.2.1'
    }
}

ext {
    supportlib_version = '27.1.1'
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$supportlib_version"
            }
        }
    }
}


allprojects {
    repositories {//这里是pull仓库用到的加速地址
        //jcenter()

        mavenCentral()
        maven {
            url 'http://172.16.22.18:8081/repository/maven-public/'
        }
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
        google()
        maven {
            url 'https://dl.bintray.com/tianjianshi1989/maven/'
        }
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'https://dl.bintray.com/caoustc/maven/'
        }
        maven {
            url "http://dl.bintray.com/piasy/maven"
        }
        maven {
            url 'http://developer.huawei.com/repo/'
        }
        maven {
            url 'http://developer.huawei.com/repo/'
        }
        maven {
            url 'http://116.62.59.245:8081/nexus/content/repositories/android/'
        }
    }

}


你可能感兴趣的:(Android使用私服加速构建教程)