Scenario: If the company has many Android projects, if it needs to maintain public components or lib, this time to build their own private server or publish to jCenter, so that the project can quickly build and use the latest components, see another article to build jCenter, the steps to build private server are as follows: 1. Install Nexus on server and get account name and password. 2

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}
Copy the code

Add it to build.gradle in the Module (library to upload) project

apply plugin: 'maven'
Copy the code
uploadArchives{
    repositories.mavenDeployer(){// The url is the host repository address.'http://***********/nexus/content/repositories/sysdk/'{// the userName and password are the userName and password for logging in to the private server.'* * * * *', password: '* * * * * * * *')
        }
   //compile 'com. * * * * * * : sysdk: hundreds'The reference corresponds to the following name pom.version='hundreds'    
        pom.artifactId='sysdk'
        pom.groupId='com.*****'}}Copy the code

7. Upload Module to private server and click the red area

Add reference

// add private server reference compile'com. * * * * * * : sysdk: hundreds'      
Copy the code

Then you can use it as if you were referencing the lib project, and it feels different.