{"id":11,"date":"2021-11-11T07:50:30","date_gmt":"2021-11-11T07:50:30","guid":{"rendered":"http:\/\/82.157.166.8\/?p=11"},"modified":"2021-12-02T09:09:27","modified_gmt":"2021-12-02T09:09:27","slug":"maven-central-%e4%b8%8a%e4%bc%a0","status":"publish","type":"post","link":"http:\/\/www.devblog.cn\/?p=11","title":{"rendered":"maven Central \u4e0a\u4f20"},"content":{"rendered":"<h1>maven Central \u4e0a\u4f20<\/h1>\n<h2>\u4e00\u3001Sonatype \u8d26\u53f7<\/h2>\n<p><a href=\"https:\/\/fullstackaction.com\/pages\/8ad3be\">https:\/\/fullstackaction.com\/pages\/8ad3be<\/a><\/p>\n<h3>1\u3001\u6ce8\u518c Sonatype<\/h3>\n<h3>2\u3001\u7533\u8bf7\u4e0a\u4f20\u6743\u9650<\/h3>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/cdn.jsdelivr.net\/gh\/FullStackAction\/PicBed@resource20210320170901\/image\/20210421191607.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/cdn.jsdelivr.net\/gh\/FullStackAction\/PicBed@resource20210320170901\/image\/20210421191607.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"enter image description here\" \/><\/div><\/p>\n<p><code>Group Id<\/code> :\u5982<code>io.github.zrq1060<\/code><\/p>\n<h2>\u4e8c\u3001GPG \u7b7e\u540d<\/h2>\n<p><a href=\"https:\/\/juejin.cn\/post\/6951209116521988132#heading-3\">https:\/\/juejin.cn\/post\/6951209116521988132#heading-3<\/a><br \/>\n<a href=\"https:\/\/www.jianshu.com\/p\/1c715203c7c6\">https:\/\/www.jianshu.com\/p\/1c715203c7c6<\/a><\/p>\n<h3>1\u3001\u5b89\u88c5 gpg<\/h3>\n<h3>2\u3001\u751f\u6210\u5bc6\u94a5<\/h3>\n<pre><code>gpg --full-generate-key<\/code><\/pre>\n<p>\u5728\u6267\u884c\u8fc7\u7a0b\u4f1a\u8ba9\u9009\u62e9\u52a0\u5bc6\u65b9\u5f0f\uff0c\u6211\u8fd9\u8fb9\u4f7f\u7528\u7684\u662f<code>RSA and RSA<\/code>\uff0c\u957f\u5ea6\u8f93\u5165<code>4096<\/code>\uff0c\u8fc7\u671f\u65f6\u95f4\u76f4\u63a5<code>\u56de\u8f66<\/code>\u4ee3\u8868\u4e0d\u8fc7\u671f\uff0c\u7136\u540e\u63d0\u793a\u8ba9\u8f93\u5165<code>User ID<\/code>\u548c\u4e00\u4e2a<code>\u90ae\u7bb1<\/code>\uff0c\u8fd9\u91cc\u53ef\u4ee5\u4f7f\u7528\u6ce8\u518cSonaType\u65f6\u5019\u7528\u7684\u7528\u6237\u540d\u548c\u90ae\u7bb1\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528\u5176\u4ed6\u7684\u3002\u63a5\u7740\u6700\u540e\u4e00\u6b65\u8f93\u5165<code>O<\/code>\uff0c\u6ce8\u610f\u8fd9\u91cc\u662f\u5927\u5199\u7684O\u4e0d\u662f\u96f6\uff0c\u7136\u540e\u56de\u8f66\u63a5\u7740\u5c31\u4f1a\u63d0\u793a\u8ba9\u8f93\u5165<code>\u5bc6\u7801<\/code>\uff0c\u8f93\u5165\u4e00\u6b21\u540e\u8fd8\u4f1a\u6709\u4e00\u6b21\u786e\u8ba4\u8f93\u5165\uff0c\u8fd9\u4e2a\u5bc6\u7801\u4e00\u5b9a\u8981\u8bb0\u4f4f\u540e\u671f\u4f1a\u7528\u5230\u3002<\/p>\n<h3>3\u3001\u751f\u6210secretKeyRingFile\u7684\u6587\u4ef6<\/h3>\n<p>\u5207\u5230<code>~\/.gnupg\/<\/code>\u4e0b\u518d\u53bb\u6267\u884c<\/p>\n<pre><code>gpg --export-secret-keys -o secring.gpg<\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0a\u547d\u4ee4\u521b\u5efa\u6587\u4ef6<code>secring.gpg<\/code>\uff0c\u521b\u5efa\u8fc7\u7a0b\u4f1a\u8ba9\u8f93\u5165\u4e0a\u8fb9\u6211\u4eec\u521b\u5efa\u5bc6\u94a5\u8fc7\u7a0b\u4e2d\u8f93\u5165\u7684\u5bc6\u7801\uff0c\u9a8c\u8bc1\u5b8c\u5bc6\u7801\u540e\u4f1a\u5728<code>~\/.gnupg<\/code>\u76ee\u5f55\u751f\u6210<code>secring.gpg<\/code>\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7684\u8def\u5f84\u6211\u4eec\u540e\u7eed\u5728\u751f\u6210\u914d\u7f6e\u6587\u4ef6\u7684\u65f6\u5019\u4e5f\u9700\u8981\u3002<\/p>\n<h3>4\u3001\u4e0a\u4f20\u516c\u94a5<\/h3>\n<p>\u60a8\u5df2\u7ecf\u751f\u6210\u4e86\u4e00\u5bf9\u5bc6\u94a5\u2014\u4e00\u4e2a\u79c1\u94a5\u548c\u4e00\u4e2a\u516c\u94a5\u3002\u4f60\u8981\u628a\u79c1\u94a5\u85cf\u8d77\u6765\u7528\u5b83\u6765\u7ed9\u4f60\u7684<code>artifacts<\/code>\u7b7e\u540d\u3002\u516c\u94a5\u5fc5\u987b\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u6837\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u68c0\u67e5\u5b83\u662f\u5426\u5c5e\u4e8e\u4f60\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u6765\u505a(\u4f7f\u7528\u4f60\u81ea\u5df1\u7684\u5bc6\u94a5ID!):<\/p>\n<pre><code>gpg --keyserver keyserver.ubuntu.com --send-keys [\u5bc6\u94a5\u6307\u7eb9]<\/code><\/pre>\n<h2>\u4e8c\u3001Gradle \u914d\u7f6e<\/h2>\n<p><a href=\"https:\/\/github.com\/vanniktech\/gradle-maven-publish-plugin\">https:\/\/github.com\/vanniktech\/gradle-maven-publish-plugin<\/a><\/p>\n<h3>1\u3001build.gradle<\/h3>\n<p><strong>progect build.gradle<\/strong><\/p>\n<pre><code class=\"language-groovy\">buildscript {\n  repositories {\n    mavenCentral()\n  }\n  dependencies {\n    classpath &#039;com.vanniktech:gradle-maven-publish-plugin:0.15.1&#039;\n  }\n}<\/code><\/pre>\n<p><strong>library build.gradle<\/strong><\/p>\n<pre><code class=\"language-groovy\">apply plugin: &quot;com.vanniktech.maven.publish&quot;<\/code><\/pre>\n<h3>2\u3001\u8bbe\u7f6e\u5c5e\u6027<\/h3>\n<p>\u5728<code>gradle.properties<\/code>\u4e2d\u6dfb\u52a0\u3002<\/p>\n<pre><code class=\"language-groovy\">GROUP=com.test.mylibrary\nPOM_ARTIFACT_ID=mylibrary-runtime\nVERSION_NAME=3.0.5\n\nPOM_NAME=My Library\nPOM_DESCRIPTION=A description of what my library does.\nPOM_INCEPTION_YEAR=2020\nPOM_URL=https:\/\/github.com\/username\/mylibrary\/\n\nPOM_LICENCE_NAME=The Apache Software License, Version 2.0\nPOM_LICENCE_URL=https:\/\/www.apache.org\/licenses\/LICENSE-2.0.txt\nPOM_LICENCE_DIST=repo\n\nPOM_SCM_URL=https:\/\/github.com\/username\/mylibrary\/\nPOM_SCM_CONNECTION=scm:git:git:\/\/github.com\/username\/mylibrary.git\nPOM_SCM_DEV_CONNECTION=scm:git:ssh:\/\/git@github.com\/username\/mylibrary.git\n\nPOM_DEVELOPER_ID=username\nPOM_DEVELOPER_NAME=User Name\nPOM_DEVELOPER_URL=https:\/\/github.com\/username\/<\/code><\/pre>\n<p><code>GROUP<\/code>\u5982<code>io.github.zrq1060<\/code><\/p>\n<h3>3\u3001\u4e0a\u4f20\u5230\u54ea\u91cc<\/h3>\n<h4>3.1\u3001\u4e0a\u4f20\u5230 s01.oss.sonatype.org<\/h4>\n<p><strong>progect build.gradle<\/strong><\/p>\n<pre><code class=\"language-groovy\">allprojects {\n    plugins.withId(&quot;com.vanniktech.maven.publish&quot;) {\n        mavenPublish {\n            sonatypeHost = &quot;S01&quot;\n        }\n    }\n}<\/code><\/pre>\n<h4>3.2\u3001\u914d\u7f6eSonatype\u7684\u4fe1\u606f<\/h4>\n<p>\u7531\u4e8e\u5176\u5177\u6709\u9690\u79c1\u6027\uff0c\u6240\u4ee5\u653e\u5230<code>Global Properties<\/code>(\u5982\uff1a\/home\/zrq1060\/.gradle\/gradle.properties)\u4e0b<\/p>\n<pre><code class=\"language-groovy\">mavenCentralUsername=\u7528\u6237\u540d\nmavenCentralPassword=\u5bc6\u7801<\/code><\/pre>\n<h3>4\u3001\u7b7e\u540d<\/h3>\n<h3>5\u3001\u914d\u7f6e\u7b7e\u540d\u4fe1\u606f<code>Group Id<\/code> :\u5982\uff1a<code>io.github.zrq1060<\/code><\/h3>\n<p>\u7531\u4e8e\u5176\u5177\u6709\u9690\u79c1\u6027\uff0c\u6240\u4ee5\u653e\u5230<code>Global Properties<\/code>(\u5982\uff1a\/home\/zrq1060\/.gradle\/gradle.properties)\u4e0b<\/p>\n<pre><code class=\"language-groovy\">signing.keyId=\u79d8\u94a5\u540e8\u4f4d\nsigning.password=\u8bbe\u7f6e\u7684\u5bc6\u7801\nsigning.secretKeyRingFile=\/home\/yourusername\/.gnupg\/secring.gpg<\/code><\/pre>\n<h3>6\u3001Releasing<\/h3>\n<pre><code># prepare your release by assigning a version (remove the -SNAPSHOT suffix)\n.\/gradlew publish --no-daemon --no-parallel\n.\/gradlew closeAndReleaseRepository<\/code><\/pre>\n<p>\u5b83\u5047\u8bbe\u8c03\u7528 <code>closeAndReleaseRepository<\/code> \u65f6\u53ea\u6709\u4e00\u4e2a\u4e34\u65f6\u5b58\u50a8\u5e93\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u3002\u5982\u679c\u60a8\u6709\u9648\u65e7\u7684\u4e34\u65f6\u5b58\u50a8\u5e93\uff0c\u5219\u5fc5\u987b\u901a\u8fc7\u767b\u5f55https:\/\/oss.sonatype.org\uff08\u6216\u60a8\u7684 Nexus \u5b9e\u4f8b\uff09\u6765<code>\u5220\u9664<\/code>\u5b83\u4eec\u3002<\/p>\n<h2>\u56db\u3001\u53d1\u5e03<\/h2>\n<h3>1\u3001\u4e0a\u4f20<\/h3>\n<pre><code class=\"language-groovy\">.\/gradlew publish --no-daemon --no-parallel<\/code><\/pre>\n<p>\u6216\u53ef\u6267\u884c<code>Tasks<\/code>\u4e0b\u7684<code>publishing<\/code>\/<code>publish<\/code><\/p>\n<h3>2\u3001\u5173\u95ed\u5e76\u53d1\u5e03<\/h3>\n<pre><code>.\/gradlew closeAndReleaseRepository<\/code><\/pre>\n<p>\u6216\u53ef\u6267\u884c<code>Tasks<\/code>\u4e0b\u7684<code>release<\/code>\/<code>closeAndReleaseRepository<\/code><br \/>\n\u6216\u53ef\u8fdb\u5165https:\/\/s01.oss.sonatype.org\/#stagingRepositories\u4e0b\u8fdb\u884c\u5bf9\u5e94\u56fe\u5f62\u5316\u64cd\u4f5c<\/p>\n<p>\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u5c31\u53ef\u4ee5\u5728 <a href=\"https:\/\/search.maven.org\/\">https:\/\/search.maven.org\/<\/a> \u67e5\u8be2\u53d1\u5e03\u7ed3\u679c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>maven Central \u4e0a\u4f20 \u4e00\u3001Sonatype \u8d26\u53f7 https:\/\/fullstackaction. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[14,15],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-gradle","tag-gradle","tag-maven-central"],"modified_by":"admin","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11"}],"version-history":[{"count":6,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":66,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/11\/revisions\/66"}],"wp:attachment":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}