Provide an easy way to publish your archives(AARS or JARS) to Maven Central
-
dependence happymaven
buildscript { repositories { mavenCentral() } dependencies { classpath 'engineer.echo:happymaven:0.0.9' } }
-
sonatype account and sign key(gpg secret key) in
~/.gradle/gradle.properties
(orUsers/your name/.gradle/gradle.properties
)NEXUS_USER_NAME = yourUsername NEXUS_PASSWORD = yourPassword signing.keyId=gpg secret key id like B1855705 signing.password=gpg key password signing.secretKeyRingFile=/Users/your name/.gnupg/secring.gpg
-
root project config reference
ext.HappyMaven = [ "GROUP_ID" : "engineer.echo", "PACKAGING" : "aar", "LICENSE_NAME" : "The Apache Software License, Version 2.0", "LICENSE_URL" : "http://www.apache.org/licenses/LICENSE-2.0.txt", "LICENSE_DIST" : "repo", "DEVELOPER_ID" : "pluckypan", "DEVELOPER_NAME" : "Plucky Pan", "RELEASE_REPO_URL" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/", "SNAPSHOT_REPO_URL": "https://oss.sonatype.org/content/repositories/snapshots/", "NEXUS_USER_NAME" : NEXUS_USER_NAME, "NEXUS_PASSWORD" : NEXUS_PASSWORD ]
-
library module config reference
apply plugin: 'happy-maven' HappyMaven { artifactId = "ylib" version = "0.0.1" }
-
upload archives
or run
./gradlew ylib:uploadArchives
-
mavenCentral() maven
- release url
https://oss.sonatype.org/service/local/staging/deploy/maven2/
- snapshot url
https://oss.sonatype.org/content/repositories/snapshots/
- search your library
https://search.maven.org/
- check staging repositories
https://oss.sonatype.org/#stagingRepositories
- more help -> 发布Maven构件到中央仓库 & sonatype issue
- release url
-
jcenter() bintray
- not support yet.coming soon
- search
https://bintray.com/search?query=happymaven
-
gen gpg secret key (Mac)
brew install gnupg
- or download dmg form http://www.gpgtools.org/
- test gpg
gpg --help
orgpg --version
- gen key
gpg --full-generate-key
- output secret key:
gpg -o .gnupg/secring.gpg --export-secret-keys
- send publish key
gpg --keyserver http://pool.sks-keyservers.net:11371/ --send-keys B1855705
orgpg --keyserver http://keyserver.ubuntu.com:11371/ --send-keys B1855705
ext.HappyMaven = [
"GROUP_ID": "engineer.echo",
"ARTIFACT_ID": "happymaven",
"VERSION": "0.0.4",
"PACKAGING": "aar",
"RELEASE_REPO_URL": "https://oss.sonatype.org/service/local/staging/deploy/maven2/",
"SNAPSHOT_REPO_URL": "https://oss.sonatype.org/content/repositories/snapshots/",
"NEXUS_USER_NAME": "plucky",
"NEXUS_PASSWORD": "xxxxxx",
"POM_NAME": "HappyMaven",
"POM_DESC": "Easy to publish android library.",
"POM_URL": "https://github.com/Pluckypan/HappyMaven",
"SCM_URL": "https://github.com/Pluckypan/HappyMaven.git",
"SCM_CONNECTION": "scm:[email protected]:Pluckypan/HappyMaven.git",
"SCM_DEV_CONNECTION": "scm:[email protected]:Pluckypan/HappyMaven.git",
"LICENSE_NAME": "The Apache Software License, Version 2.0",
"LICENSE_URL": "http://www.apache.org/licenses/LICENSE-2.0.txt",
"LICENSE_DIST": "repo",
"DEVELOPER_ID": "pluckypan",
"DEVELOPER_NAME": "Plucky Pan"
]
apply plugin: 'happy-maven'
HappyMaven {
groupId = "engineer.echo"
artifactId = "happymaven"
version = "0.0.4"
packaging = "aar"
releaseRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
nexusUserName = "plucky"
nexusPassword = "xxxxxx"
pomName = "HappyMaven"
pomDesc = "Easy to publish android library."
pomUrl = "https://github.com/Pluckypan/HappyMaven"
scmUrl = "https://github.com/Pluckypan/HappyMaven.git"
scmConnection = "scm:[email protected]:Pluckypan/HappyMaven.git"
scmDevConnection = "scm:[email protected]:Pluckypan/HappyMaven.git"
licenseName = "The Apache Software License, Version 2.0"
licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt"
licenseDist = "repo"
developerId = "pluckypan"
developerName = "Plucky Pan"
}
V. TODO
Ⅵ. License
Copyright [2019] [Plucky Pan]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.