preface

As you know, we recently received news that…

Yes, that’s right, the JCenter repository we’ve been using has been deprecated. If you think this news doesn’t affect you yet, that’s ok. Let’s introduce a new remote dependency publishing method.

Ali Cloud warehouse release

Step 1 Register an Ali Cloud account

Since this is a necessary link, please click ali Cloud address registration if you have an Ali Cloud account, please go to the second step

Step 2 Integration and use

1. Open theAliyun Warehouse

2. Click to open the service

3. Click Production library -Release (for example)

4. How to use it?

  • A. Add it where the warehouse address is added to the project

  • B. When publishing the application, configure the following in the build.gradle file of the module to be published:

  • C. Publish the application

Find Gradle in the side, find the module you want to publish, and click uploadArchives

ALIYUN_MAVEN_URL Warehouse address ALIYUN_USERNAME user name ALIYUN_PASSWORD PasswordCopy the code

The following figure shows how to obtain the key and URL

5. Global configuration

To make your private repository available to all projects, you can configure it in the gradle.properties file in the. Gradle cache folder

As follows:

  • Open the gradle.properties file in the personal. Gradle cache directory
Windows: C:\Users\ username \.gradle Mac: /Users/ username /.gradleCopy the code

  • Add the following three lines:

  • Click Save to enable the local configuration to take effect in all projects.

This is the end of the article, should you look at the request, the following collation is replicable content. If not, ignore it.


Gradle. properties file. Modify it yourself

ALIYUN_MAVEN_URL= Warehouse address ALIYUN_USERNAME= user name ALIYUN_PASSWORD= passwordCopy the code

The warehouse address was added

 maven {
            url ALIYUN_MAVEN_URL
            credentials {
                username ALIYUN_USERNAME
                password ALIYUN_PASSWORD
            }
        }
Copy the code

The build.gradle configuration for the module to be published is as follows

Def groupId = "com.xxxxxx. XXXXX "def version = '1.0.0' def artifactId = 'XXXXXX' apply: 'maven' uploadArchives { repositories { mavenDeployer { repository(url: ALIYUN_MAVEN_URL) { authentication( userName: ALIYUN_USERNAME, password: ALIYUN_PASSWORD ) } pom.version = version pom.artifactId = artifactId pom.groupId = groupId } } }Copy the code