Skip to content

Publish to Jcenter

snackwang edited this page Aug 7, 2019 · 2 revisions

Distributing HiveSDK jar package via jcenter

1. Introduction

For the convenience of Apps, hivesdk.jar package would be distributed to community developers via jfrog binary (jcenter) platform in public. Therefore, developers of Apps using Hive SDK could use manager to make hivesdk.jar as its dependency project.

The rest of this document elaborates the details of HOW-TO make distribution via jfrog binary (jcenter) platform.

2. Table of Contents

3. Get Started

Register Account

Try to sign up for an account at jfrog binary.

Recording API Key

After registration, there is an API key on https://bintray.com/profile/edit. Copy the API key for laster use.

Create Maven Repo

Try to create a repository on repositories item on https://bintray.com/profile/edit(https://bintray.com/profile/edit).

Notice: Choose the type with maven.

Configure Gradle

Add these dependencies to the build.gradle of the module that will be published:

apply plugin: 'com.novoda.bintray-release'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.novoda:bintray-release:<latest-version>'
    }
}

In the module build.gradle file, add the following configuration:

publish {
    userOrg = 'elastos'
    groupId = 'org.elastos'
    artifactId = 'hive'
    publishVersion = '0.1.0'
    desc = 'Elastos.NET.Hive.Java.SDK'
    website = 'https://github.com/elastos/Elastos.NET.Hive.Java.SDK'
}

Distribution

Finally, use the taskbintrayUpload to publish (make sure you build the project first) with following command in Android Studio Terminal:

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

Where, the value BINTRAY_USERNAME is your username and BINTRAY_KEY is the previously your API key.

Submit to jCenter

When bintrayUpload succeeds, you will see the project you submitted in the bintray home page maven directory.

Click on the project name to go to the details page and find it in the lower right corner. Anter with clicking and complete project descriptions.

After submitting, the post will be sent after the successful review, and the review will be quick, provided they are working.

Waiting Approval

The rest is to wait for approval. After the audit is passed, our SDK is released to the jcenter repository.

4. Usage Example

In your project with gradle management, add following statements in module's build.gradle to import Hive SDK:

dependencies {
    implementation 'org.elastos:hive:0.5.0'
}

While in project with maven management, add the following statements as it's dependency:

<dependency>
  <groupId>org.elastos</groupId>
  <artifactId>hive</artifactId>
  <version>0.5.0</version>
  <type>pom</type>
</dependency>