Like to do some open source project friends, I believe that many people want to be able to publish their own projects to the public central warehouse, such as the MAVEN central warehouse, for others to facilitate the integration of use. The students who use Android studio should also be impressed with Gradle and Jcenter, and many open source libraries are posted here. This article is mainly about how to use Gradle to publish to Jcenter.
This article is original.
Reprint please indicate CSDN blog Source:
http://blog.csdn.net/maosidiaoxian/article/details/43148643
Register first to https://bintray.com to register an account.
Configure the account we need to configure the Bintray_user and Bintray_key two properties. Bintray_user is your registered account name, Bintray_key can be found in the following ways. , first click on your account name to enter the personal page.
Then click Edit to go to the editing page.
Then click on API Key, then click on the right side of show to see the API key.
Configuration Items Download My project: https://github.com/msdx/gradle-publish, copy the gradle.properties into your project, and configure the properties.
Then refer to the build.gradle here to add to your build.gradle:
Buildscript { repositories { jcenter () } dependencies { classpath ' Com.jfrog.bintray.gradle: gradle-bintray-plugin:1.0 ' }}
Add one more sentence:
Apply from: ' The relative path of your bintray.gradle '
The reason why I don't use the http://xxxx path is because the file is my Android project first, and then this project maybe I'll update later.
Your bintray.gradle can refer to this to write, my bintray.gradle here is used to publish Android projects, published files including source code, documents and AAR.
After the command is executed for release configuration, execution of Gradle Bintray is compiled, packaged, and published.
Auditing waits for administrator approval. It's usually going to pass quickly. If you're impatient, you can refer to Maven {URL http://dl.bintray.com/your user name/maven} before you approve it.
Additional instructions If you add this script and run the project in Android Studio, you will get an error, please comment on the "apply from" clause. The reason for the error is that it will not be able to find the task I packaged with AAR, but it is ok under the command line. If there is a better way to pack AAR, welcome to the exchange.
Use Gradle to publish Android open source projects to Jcenter