{"id":1468,"date":"2017-01-06T21:38:13","date_gmt":"2017-01-06T13:38:13","guid":{"rendered":"http:\/\/coderbee.net\/?p=1468"},"modified":"2017-01-06T21:38:13","modified_gmt":"2017-01-06T13:38:13","slug":"%e5%8f%91%e5%b8%83%e7%bb%84%e4%bb%b6%e5%88%b0-maven-%e4%b8%ad%e5%a4%ae%e4%bb%93%e5%ba%93","status":"publish","type":"post","link":"https:\/\/coderbee.net\/index.php\/java\/20170106\/1468","title":{"rendered":"\u53d1\u5e03\u7ec4\u4ef6\u5230 Maven \u4e2d\u592e\u4ed3\u5e93"},"content":{"rendered":"<p>\u6298\u817e\u4e86\u51e0\u5929\uff0c\u7ec8\u4e8e\u628a\u4e00\u4e2a\u5c0f\u7ec4\u4ef6<a href=\"https:\/\/github.com\/wen866595\/MyBatis-batch\">MyBatis-batch<\/a> \u53d1\u5e03\u4e86\u4e2d\u592e\u4ed3\u5e93\uff0c\u505a\u4e2a\u7b14\u8bb0\u8bb0\u5f55\u4e0b\u3002<\/p>\n<ol>\n<li>\u6ce8\u518c sonatype JIRA \u5e10\u53f7\u5e76\u914d\u7f6e settings.xml<br \/>\n\u6211\u662f\u5148\u5728 sonatype \u4e0a\u53d1\u5e03\uff0c\u7136\u540e\u7531 sonatype \u81ea\u52a8\u540c\u6b65\u5230\u4e2d\u592e\u4ed3\u5e93\u7684\u3002\u9996\u5148\u8981\u5728 sonatype \u6ce8\u518c\u4e00\u4e2a JIRA \u5e10\u53f7\uff0c<\/li>\n<\/ol>\n<p>\u5728 <code>$M2_HOME\/conf\/settings.xml<\/code> \u7684 <code>servers<\/code> \u6807\u7b7e\u4e0b\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"xml\">&lt;server&gt;\n    &lt;id&gt;sonatype-nexus&lt;\/id&gt;\n    &lt;username&gt;sonatype \u767b\u5f55\u540d&lt;\/username&gt;\n    &lt;password&gt;sonatype \u5bc6\u7801&lt;\/password&gt;\n&lt;\/server&gt;\n<\/code><\/pre>\n<ol>\n<li>\u5728 github \u6dfb\u52a0 ssh key<br \/>\nMaven \u6784\u5efa\u7684\u65f6\u5019\uff0c\u4f1a\u81ea\u52a8\u64cd\u4f5c github\uff0c\u6bd4\u5982\u521b\u5efa tag \u3002<br \/>\n\u7528 ssh-keygen \u751f\u6210\u4e00\u5bf9\u79d8\u94a5\uff0c\u5728 <a href=\"https:\/\/github.com\/settings\/keys\">https:\/\/github.com\/settings\/keys<\/a> \u9875\u9762\u53ef\u4ee5\u6dfb\u52a0 SSH key\u3002<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<ol>\n<li>\u751f\u6210 GPG key<br \/>\nsonatype \u8981\u6c42\u5bf9\u4e0a\u4f20\u7684\u7ec4\u4ef6\u8fdb\u884c\u6821\u9a8c\uff0c\u9700\u8981 gpg key\u3002<\/li>\n<\/ol>\n<p>\u751f\u6210key \u7528\u547d\u4ee4 <code>gpg --gen-key<\/code>\uff0c\u4f1a\u8981\u6c42\u8f93\u5165\u4e00\u4e9b\u4fe1\u606f\uff0c<\/p>\n<p>\u67e5\u770b\u751f\u6210\u7684key\uff1a<\/p>\n<pre><code>$ gpg --list-keys\n\/c\/Users\/coderbee\/.gnupg\/pubring.gpg\n------------------------------------\npub   2048R\/C74F60E4 2016-12-24\nuid                  bruce.liu &lt;wen866595@163.com&gt;\nsub   2048R\/27062C6D 2016-12-24\n<\/code><\/pre>\n<p><code>2048R\/C74F60E4<\/code> \u4e2d\u7684 2048 \u8868\u793a key \u7684\u4f4d\u6570\uff0c\u540e\u9762\u7684 <code>C74F60E4<\/code> \u7684 key id\uff0c\u4e0a\u4f20\u7528\u5230\u7684\u3002<\/p>\n<p><code>gpg --keyserver hkp:\/\/pool.sks-keyservers.net --send-keys key-id<\/code><\/p>\n<ol>\n<li>\n<p>\u5728 sonatype \u4e0a\u521b\u5efa\u4e00\u4e2a project issue<br \/>\n\u5730\u5740\uff1a <code>https:\/\/issues.sonatype.org<\/code>\uff0c\u767b\u5f55\u540e\u70b9\u51fb\u5927\u5927\u7684 <code>Create<\/code> \u6309\u94ae\uff0c\u9009\u62e9 Project \u4e3a <code>Community Support - Open Source Project Repository Hosting (OSSRH)<\/code>\uff0c\u586b\u5199\u76f8\u5173\u4fe1\u606f\uff0c\u521b\u5efa\u540e\u7b49\u5f85\u5ba1\u6838\uff0c\u5ba1\u6838\u901a\u8fc7\u540e\u4f1a\u6709\u90ae\u4ef6\u63d0\u9192\u7684\u3002\u90ae\u4ef6\u91cc\u6709\u4e9b\u4fe1\u606f\u53ef\u4ee5\u4ed4\u7ec6\u770b\u770b\uff0c\u6bd4\u5982\u7b2c\u4e00\u6b21\u53d1\u5e03\u65f6\u8981\u5728\u8fd9\u4e2a issue \u4e0b comment\uff0c\u540e\u7eed\u53d1\u5e03\u4e0d\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e pom.xml<br \/>\npom.xml \u7684\u914d\u7f6e\u53ef\u53c2\u8003 <code>https:\/\/github.com\/wen866595\/MyBatis-batch\/blob\/master\/pom.xml<\/code> \u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u4e0b\u9762\u7684\u914d\u7f6e\u662f snapshot \u548c release \u7248\u7684\u53d1\u5e03\u5730\u5740\uff0c\u5176\u4e2d <code>&lt;id&gt;sonatype-nexus&lt;\/id&gt;<\/code> \u8981\u8ddf\u524d\u9762 <code>settings.xml<\/code> \u91cc\u914d\u7f6e\u7684\u4e00\u81f4\u3002<\/p>\n<pre><code class=\"xml\">&lt;distributionManagement&gt;\n    &lt;snapshotRepository&gt;\n        &lt;id&gt;sonatype-nexus&lt;\/id&gt;\n        &lt;url&gt;https:\/\/oss.sonatype.org\/content\/repositories\/snapshots&lt;\/url&gt;\n    &lt;\/snapshotRepository&gt;\n    &lt;repository&gt;\n        &lt;id&gt;sonatype-nexus&lt;\/id&gt;\n        &lt;url&gt;https:\/\/oss.sonatype.org\/service\/local\/staging\/deploy\/maven2\/&lt;\/url&gt;\n    &lt;\/repository&gt;\n&lt;\/distributionManagement&gt;\n<\/code><\/pre>\n<p>sonatype \u5bf9\u4e8e pom.xml \u5fc5\u987b\u5305\u542b\u54ea\u4e9b\u5143\u7d20\u662f\u6709\u8981\u6c42\u7684\u3002\u8981\u5148\u53d1\u5e03 <code>-snapshot<\/code> \u7248\uff0c\u7136\u540e\u624d\u80fd\u53d1\u5e03\u6b63\u5f0f\u7248\uff0c\u5373\u4e0d\u5e26 <code>-snapshot<\/code> \u7684\u3002<\/p>\n<pre><code># \u901a\u8fc7 profile \u53d1\u5e03\uff0c\u6b64\u6cd5\u4e0d\u4f1a\u81ea\u52a8\u5728 github \u4e0a\u521b\u5efa\u4e00\u4e2a release \u3002\n\n#  \u53d1\u5e03 snapshot \u7248\nmvn clean deploy\n\nmvn versions:set -DnewVersion=1.1.0\n\nmvn clean deploy -P release\n#----------------------------------------  \u901a\u8fc7 profile \u53d1\u5e03 end\n\n\n# \u5728 github \u521b\u5efa\u4e00\u4e2a release\nmvn release:clean release:prepare\n\n# \u53d1\u5e03\u7684\u662f snapshot \u7248\u3002\nmvn release:perform\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u6267\u884c\u6210\u529f\u540e\uff0c\u767b\u5f55 <code>https:\/\/oss.sonatype.org\/#stagingProfiles<\/code> \u627e\u5230\u81ea\u5df1\u7684\u9879\u76ee\uff0c\u7136\u540e <code>close<\/code>\u3001<code>release<\/code> \uff0c\u5982\u679c\u662f\u7b2c\u4e00\u6b21\u53d1\u5e03\uff0c\u8981\u518d\u53bb\u524d\u9762\u7684 issue \u4e0a\u63d0\u4e2a comment \u8bf4\u660e\u4e00\u4e0b\uff0c\u7136\u540e\u7b49\u5ba1\u6838\uff0c\u5ba1\u6838\u901a\u8fc7\u540ejar \u5c31\u80fd\u540c\u6b65\u5230\u4e2d\u592e\u4ed3\u5e93\u4e86\uff0c\u8fd9\u4e2a\u540c\u6b65\u9700\u8981\u4e00\u5b9a\u7684\u65f6\u95f4\u3002<\/p>\n<h2>\u53c2\u8003\u6587\u6863<\/h2>\n<p><a href=\"http:\/\/central.sonatype.org\/pages\/apache-maven.html\">Deploying to OSSRH with Apache Maven<\/a><\/p>\n<hr\/>\n<p>\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u5fae\u4fe1\u516c\u4f17\u53f7: <strong>coderbee\u7b14\u8bb0<\/strong>\uff0c\u53ef\u4ee5\u66f4\u53ca\u65f6\u56de\u590d\u4f60\u7684\u8ba8\u8bba\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"258\" height=\"258\" src=\"https:\/\/coderbee.net\/wp-content\/uploads\/2019\/01\/coderbee-note.jpg\" class=\"alignnone size-full wp-image-1707\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6298\u817e\u4e86\u51e0\u5929\uff0c\u7ec8\u4e8e\u628a\u4e00\u4e2a\u5c0f\u7ec4\u4ef6MyBatis-batch \u53d1\u5e03\u4e86\u4e2d\u592e\u4ed3\u5e93\uff0c\u505a\u4e2a\u7b14\u8bb0 &hellip; <a href=\"https:\/\/coderbee.net\/index.php\/java\/20170106\/1468\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[117,265],"_links":{"self":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1468"}],"collection":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/comments?post=1468"}],"version-history":[{"count":1,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1468\/revisions"}],"predecessor-version":[{"id":1469,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1468\/revisions\/1469"}],"wp:attachment":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/media?parent=1468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/categories?post=1468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/tags?post=1468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}