Ready to work
- create an
bintray
account;- In https://bintray.com/ , select "Sign Up Here" in the box as shown below:
- Choose the appropriate method to create an account:
- In https://bintray.com/ , select "Sign Up Here" in the box as shown below:
- New warehouse:
Add New Repository
Create Repository
Type select "Maven", Name is best to fill in "maven" directly.
Here is the repository I created:
Create ApiKey.
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.
Modify the project root directory
build.gradle
:dependencies
add the following code inclasspath '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 .
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 needpublish
to 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]
Upload:
Before uploading, make sure that your ownmodule
has beenaar
compiled.
Execute the following command on the command line:./gradlew clean build bintrayUpload -PbintrayUser=BINTRAY_USERNAME -PbintrayKey=BINTRAY_KEY -PdryRun=false
Among them,
BINTRAY_USERNAME
is the registered user name, whichBINTRAY_KEY
is just nowAPI key
.
FinallyBUILD SUCCESSFUL
, the aar is uploaded successfully, and you can view it in the relevant warehouse of your own account.
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:
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 tojcenter
China.