This project includes some gradle scripts that can publish gradle project to JCenter.
bintray.gradle: A script to publish an android gradle project to JCenter.
build.gradle: A demo about how to use it.
gradle.properties: The properties that will be used in bintray.gradle. You are needed to copy this file into your library project and configure the values of these properties.
How To Use
1. Save bintray user and API Key infos
First, you should have one bintray account,(bintray.com) and need save the account user name and API Key info to your .gradle folder. If you havent change the GRADLE_USER_HOME position, it will be under your User folder. In this folder, add the follow infos to gradle.properties file, create it if it doesn`t exist.
BINTRAY_USER=bintray account name
BINTRAY_KEY=bintray API Key
If your OS is Windows, then, the path will be C:\Documents and Settings\YourName\.gradle for XP, and C:\Users\YourName\.gradle for WIN7+.
2. modify build.gradle in your library module
Add the dependencies section into build.gradle in your library if it doesn't already exist:
Note: The Gradle version I use is 2.14.1. For the other version, you may need to upgrade or downgrade the android-maven-gradle-plugin or gradle-bintray-plugin version.
Then you need download the bintray.gradle into your library project, and add the following to the bottom of your build.gradle file:
apply from: './bintray.gradle'
3. setup gradle.properties in your library module
Copy the gradle.properties(which is in this project, not the one we modified in step 1) file to your library module, Click Here to copy it.
Then setup it as your needed. Follow is an example,
You can see, the format will be PROJ_GROUP:PROJ_ARTIFACTID:PROJ_VERSION.
4. run publish command
Execute gradle bintrayUpload to publish artifacts to bintray.com.
gradle bintrayUpload
Execute gradle artifactoryPublish to publish SNAPSHOT version to oss.jfrog.org.
gradle artifactoryPublish
5. add library to Jcenter
Send a request to bintray.com about adding the library to Jcenter, after the request be approved, others can use your library by one line code in their build.gradle files.
请发表评论