The following content is original, welcome reprint, Reprint please specify
From every day blog: http://www.cnblogs.com/tiantianbyconan/p/4388175.html
This article is for open source enthusiasts.
If you want someone else to use your Android Open Source Library, the first way is to provide your GitHub address, have someone clone it, and then let someone else import it into his project. Another simpler way is to let others add your library dependencies directly to his gradle, as follows:
Compile ' com.github.wangjiegulu:androidbucket:1.0.1 '
If you want to use the second way, you need to submit your project to the public Central Library.
Here's an introduction to using Sonatype to submit your open source library (snapshot or release) to the MAVEN Central Library.
1. First, register your account in https://issues.sonatype.org.
2. Then create a new Project ticket in the https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134.
-summary: Fill in the project name
-description: Fill in the description
-group Id: Domain name reversal, if there is no domain name, directly using GitHub inversion (such as Github.com/wangjiegulu--and Com.github.wangjiegulu), specifically see http:// Central.sonatype.org/pages/choosing-your-coordinates.html
-project URL: The URL of the project, which can be the GitHub address of the project. such as Https://github.com/wangjiegulu/AndroidBucket
-SCM URL: Version-controlled URI, such as Https://github.com/wangjiegulu/AndroidBucket.git
3. After creation, wait for the status to "resolved", then you can upload the project using Gradle.
4. The GPG signature is required before uploading, so download GPG (https://www.gnupg.org/download/index.html) First, then open
Create a new keychain, and then right-click "Send public key to key Server" so that you can send your public key to the server.
5. Then we re-package the Aar file for the project, IntelliJ Idea and Android studio built using Gradle, the file will be automatically generated in the build and can be copied directly.
6. Then create a new build.gradle to carry out our upload operation, presumably the following:
// *********************************************************************Apply plugin:' Maven 'Apply plugin:' Signing '//digitally sign with signing plugin//defining GroupID and Version,artefactid automatically uses the project nameGroup = ' Com.github.wangjiegulu 'version= ' 1.0.1 'repositories {mavencentral ();} Artifacts {Archives file (' Androidbucket.aar ')}signing {sign Configurations.archives}Uploadarchives {repositories {mavendeployer {//Digitally sign a pom filebeforedeployment {mavendeployment Deploymentsigning.signpom (Deployment)}//Specifies the Central library address to which the project is deployed, username and password are registered accounts in Part 1. Repository (URL: "https://oss.sonatype.org/service/local/staging/deploy/maven2/")) {authentication (username:ossrhusername, Password:ossrhpassword)} snapshotre Pository (URL:"Https://oss.sonatype.org/content/repositories/snapshots/") {authentication (username:ossrhusername, Password:ossrhpassword)}//to construct the Pom file for the project, see the specification of the Pom file in Part 2, do not omit the required fieldsPom.project {Name Project.name packaging' AAR 'Description' Android Development Common grooming 'URL' Https://github.com/wangjiegulu/AndroidBucket 'SCM {URL' Scm:[email protected]:wangjiegulu/androidbucket.git 'Connection' Scm:[email protected]:wangjiegulu/androidbucket.git 'developerconnection' [Email protected]:wangjiegulu/androidbucket.git '} licenses {license {name' The Apache software License, Version 2.0 'URL' Http://www.apache.org/licenses/LICENSE-2.0.txt 'Distribution' Wangjie '}} developers {developer { ID' Wangjie 'name' Wagn Jie 'Email' [Email protected] ' } } } } }}
The Archives file (' Androidbucket.aar ') indicates the specified upload of AAR files.
Signing {sign configurations.archives}
The content is GPG signed, since the need to sign, it needs to configure key information in Gradle.properites, as well as the uploaded account password:
signing.keyid=xxxxxxxxxsigning.password=xxxxxxxxxsigning.secretkeyringfile=/users/wangjie/. Gnupg/secring.gpg
Ossrhusername=oss.sonatype.org or issues.sonatype.org's account (same one)
ossrhpassword=oss.sonatype.org or issues.sonatype.org password (same one)
After all configuration is completed, perform gradle uploadarchives for upload operation.
7. Log in to https://oss.sonatype.org, click "Staging repositories" on the left, and then just upload the project name for Com.github.wangjiegulu minus Point-number
Select Click "Close" and if successful, then click "Release" button to publish.
Then wait 2 hours before you can find it in the MAVEN Center library.
Note: In the future if you need to upload other projects, directly from the 4th step, because your groupid has already applied, the new artifacts can be deployed directly into this groupid.
Reference: http://central.sonatype.org/pages/ossrh-guide.html
[Android] Use Gradle submit your own open source Android library to Maven Center library