publish aar to jcenter

Ready to work

  1. create an bintrayaccount;
    1. In https://bintray.com/ , select "Sign Up Here" in the box as shown below:
      sign up
    2. Choose the appropriate method to create an account:
      Create Account
  2. New warehouse:
    1. Add New Repository
      bashboard

    2. Create Repository

    Type select "Maven", Name is best to fill in "maven" directly.
    Here is the repository I created:
    My Repo

  3. Create ApiKey.
    API KEY

At this point, the work related to the account has been completed.

AAR upload and release

Here, the bintray-release tool is used to upload aar, which is the simplest tool I know.

  1. Modify the project root directory build.gradle: dependenciesadd the following code in

    classpath 'com.novoda:bintray-release:0.8.1'

    Among them, 0.8.1 is the latest version, and the latest version number can be viewed in bintray-release .

  2. Add under the uploaded module build.gradle:

    apply plugin: 'com.novoda.bintray-release'
    publish {
        userOrg = 'novoda'
        groupId = 'com.novoda'
        artifactId = 'bintray-release'
        publishVersion = '0.6.1'
        desc = 'Oh hi, this is a nice description for a project, right?'
        website = 'https://github.com/novoda/bintray-release'
    }

    If 准备工作the name of the repository created in me is not "maven", you need publishto add a line to it:

    repoName = 'common-util' // 这里填你自己仓库的Name

    Otherwise, the following error will be reported when uploading:

    Could not create package 'diql/maven/common-util': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]

  3. Upload:
    Before uploading, make sure that your own modulehas been aarcompiled.
    Execute the following command on the command line:

     ./gradlew clean build bintrayUpload -PbintrayUser=BINTRAY_USERNAME -PbintrayKey=BINTRAY_KEY -PdryRun=false

    Among them, BINTRAY_USERNAMEis the registered user name, which BINTRAY_KEYis just now API key.
    Finally BUILD SUCCESSFUL, the aar is uploaded successfully, and you can view it in the relevant warehouse of your own account.
    common-util

    At this time, you can add your own warehouse address, that is, the address in the figure, to your own project:

    Then use the following method to reference your own library:

  4. After the upload to jcenter
    aar is successful, you can publish your own library to it through "Add to JCenter" in the lower right corner (as shown in the figure below) jcenter.

    After the review, the account will receive relevant notifications, and the lower right corner will change to the following style:

    At this time, the project will be officially released to jcenterChina.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325406762&siteId=291194637