{"id":340,"date":"2021-01-07T21:18:38","date_gmt":"2021-01-07T13:18:38","guid":{"rendered":"https:\/\/www.chenqing.work\/?p=340"},"modified":"2021-01-07T21:23:06","modified_gmt":"2021-01-07T13:23:06","slug":"%e6%90%ad%e5%bb%ba-nexus-%e7%a7%81%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.chenqing.work\/?p=340","title":{"rendered":"\u642d\u5efa Nexus \u79c1\u670d"},"content":{"rendered":"\n<p>\u8bb0\u5f97\u6700\u65e9\u8fdb\u884c web \u5f00\u53d1\u7684\u65f6\u5019\uff0c\u91c7\u7528 SSM \u67b6\u6784\uff0c\u4e00\u4e9b\u76f8\u5173\u7684 jar \u5305\u9700\u8981\u81ea\u884c\u5230\u5b98\u7f51\u4e0a\u641c\u7d22\u4e0b\u8f7d\u5230\u672c\u5730\uff0c\u7136\u540e\u624b\u52a8\u5c06 jar \u5f15\u5165\u9879\u76ee\u4e2d\u4f7f\u7528\u3002\u800c\u4eca\u5bf9\u4e8e\u4f9d\u8d56\u7684\u7ba1\u7406\u5df2\u7ecf\u8fdb\u6b65\u4e86\u5f88\u591a\uff0c\u7531\u6784\u5efa\u5de5\u5177\uff08Maven\/Gradle\uff09\u53bb\u81ea\u52a8\u5904\u7406\uff0c\u7a0b\u5e8f\u5458\u53ea\u9700\u8981\u58f0\u660e\u9700\u8981\u4ec0\u4e48 Jar\uff0c\u53bb\u54ea\u91cc\u62ff\u3002<\/p>\n\n\n\n<p>\u5728\u4f01\u4e1a\u5185\u90e8\uff0c\u4e00\u822c\u90fd\u4f1a\u642d\u5efa\u4e00\u5957\u81ea\u5df1\u7684 Jar \u4ed3\u5e93\uff0c\u6ca1\u9519\uff0c\u5c31\u662f\u7528 Nexus\uff0cNexus \u8fd8\u53ef\u4ee5\u7528\u4f5c NPM\u3001docker\u3001helm\u3001apt\u3001yum \u7b49\u7684\u79c1\u670d\uff0c\u611f\u5174\u8da3\u53ef\u4ee5\u4e0a\u5b98\u7f51\u770b\u770b\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u91c7\u7528 Nexus 2 \u642d\u5efa\u79c1\u670d\uff0cNexus 2\uff1a<a href=\"https:\/\/download.sonatype.com\/nexus\/oss\/nexus-latest-bundle.zip\" data-type=\"URL\" data-id=\"https:\/\/download.sonatype.com\/nexus\/oss\/nexus-latest-bundle.zip\">Windows \u4e0b\u8f7d\u5730\u5740<\/a>\u3001<a href=\"https:\/\/sonatype-download.global.ssl.fastly.net\/repository\/downloads-prod-group\/oss\/nexus-2.14.20-02-bundle.tar.gz\">Linux \u4e0b\u8f7d\u5730\u5740<\/a>\u3002<\/p>\n\n\n\n<p>\u89e3\u538b\u540e\u5f97\u5230\u4e24\u4e2a\u6587\u4ef6\u5939\uff1anexus-2.14.20-02\u3001sonatype-work\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"403\" height=\"53\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image.png\" alt=\"\" class=\"wp-image-508\"\/><\/figure>\n\n\n\n<p>\u8fdb\u5165 nexus-2.14.20-02\/bin\/\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u542f\u52a8 Nexus<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/nexus start<\/code><\/pre>\n\n\n\n<p>\u535a\u4e3b\u73af\u5883\u7684\u9ed8\u8ba4 jdk \u4e3a openjdk11\uff0c\u542f\u52a8\u65f6\u62a5\u9519\uff0c\u63d0\u793a\u7f3a\u5c11\u4e86 jar\uff0c\u539f\u56e0\u662f jdk11 \u4e2d\u79fb\u9664\u4e86 javax.xml.bind \u7684 jar\uff0c\u89e3\u51b3\u65b9\u6cd5\u662f\u624b\u5de5\u5f15\u5165 jaxb-api-2.3.1.jar\u3001activation-1.1.1.jar \u5230 nexus-2.14.20-02\/lib \u4e0b\u3002\u5982\u679c\u73af\u5883\u4e2d\u5b58\u5728\u5408\u9002\u7684 jdk \u7248\u672c\uff0c\u6bd4\u5982 jdk8\uff0c\u90a3\u4e48\u4e5f\u53ef\u4ee5\u5728 nexus-2.14.20-02\/bin\/jsw\/conf\/wrapper.conf \u4e2d\u6307\u5b9a\u7a0b\u5e8f\u8fd0\u884c\u65f6\u4f7f\u7528\u7684 jdk\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set.JAVA_HOME=\/opt\/jdk1.8.0_40\/\nwrapper.java.command=%JAVA_HOME%\/bin\/java <\/code><\/pre>\n\n\n\n<p>\u542f\u52a8\u540e\uff0c\u5230\u6d4f\u89c8\u5668\u8bbf\u95ee  http:\/\/&lt;192.168.80.202&gt;:8081\/nexus\uff0c\u7ba1\u7406\u5458\u521d\u59cb\u8d26\u53f7\u4e3a admin\/admin123 \u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1911\" height=\"604\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-1.png\" alt=\"\" class=\"wp-image-510\"\/><\/figure>\n\n\n\n<p>\u70b9\u51fb\u5de6\u4fa7\u7684 Repositories \u5c31\u53ef\u4ee5\u770b\u5230\u6240\u6709\u7684\u4ed3\u5e93\uff0c\u800c\u6211\u4eec\u4e00\u822c\u8981\u5f15\u7528\u7684\u5c31\u662f Public Repository \u8fd9\u4e2a\u4ed3\u5e93\uff0c\u8fd9\u4e2a\u4ed3\u5e93\u53ef\u4ee5\u5c06\u51e0\u4e2a\u4ed3\u5e93\u4e2d\u7684 jar \u6574\u5408\u5230\u4e00\u4e2a\u7edf\u4e00\u7684\u7d22\u5f15\u8def\u5f84\u4e0b\uff0c\u7701\u53bb\u5728\u6784\u5efa\u5de5\u5177\u4e2d\u5f15\u7528\u591a\u4e2a\u4ed3\u5e93\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1869\" height=\"756\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-3.png\" alt=\"\" class=\"wp-image-513\"\/><\/figure>\n\n\n\n<p>\u5f53\u5728\u6784\u5efa\u5de5\u5177\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u597d\u4f7f\u7528\u8fd9\u4e2a\u79c1\u670d\u4ed3\u5e93\u5730\u5740\u540e\uff0c\u5728\u5411\u79c1\u670d\u8bf7\u6c42\u4f9d\u8d56\u65f6\u5982\u679c\u79c1\u670d\u6ca1\u6709\uff0c\u5c31\u4f1a\u53bb\u4e92\u8054\u7f51\u4e0a\u7684\u4e2d\u592e\u4ed3\u5e93\uff08\u6216\u8005\u5176\u4ed6\u914d\u7f6e\u4e86 Proxy \u4ed3\u5e93\u7684\u5bf9\u5e94\u5916\u7f51\u4ed3\u5e93\uff09\u4e2d\u53d6\uff0c\u5e76\u7f13\u5b58\u5230\u672c\u5730\u3002\u8fd8\u8bb0\u5f97\u538b\u7f29\u5305\u89e3\u538b\u5f97\u5230\u4e86\u4e24\u4e2a\u76ee\u5f55\uff0c\u79c1\u670d\u7684 jar \u5c31\u5b58\u5728 sonatype-work\/nexus\/storage \u4e0b\uff0c\u754c\u9762\u4e0a\u7684\u6bcf\u4e00\u4e2a\u4ed3\u5e93\u5bf9\u5e94\u4e00\u4e2a\u76ee\u5f55\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"99\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-4.png\" alt=\"\" class=\"wp-image-514\"\/><\/figure>\n\n\n\n<p>\u4ed3\u5e93\u6709\u51e0\u79cd\u7c7b\u578b\uff1agroup\uff08public\uff09\u3001hosted\uff08release\u3001snapshots\u30013rd party\uff09\u3001proxy\uff08apache snapshots\u3001central\uff09\u3001virtual\uff08central m1\uff09\u3002<\/p>\n\n\n\n<p>group \u5c31\u662f\u524d\u9762\u8bf4\u8fc7\u7684\uff0c\u628a\u591a\u4e2a\u4ed3\u5e93\u6574\u5408\u6210\u4e00\u4e2a\uff1bhosted \u662f\u5b9a\u4e49\u5728\u79c1\u670d\u672c\u5730\u7684\u4ed3\u5e93\uff1bproxy \u5bf9\u5e94\u5230\u79c1\u670d\u5916\u7684\u4ed3\u5e93\uff1bvirtual \u53ea\u662f\u4e00\u4e2a\u4ed3\u5e93\u683c\u5f0f\u9002\u914d\u5668\uff0c\u6bd4\u5982\u8fd9\u91cc\u628a central \u9002\u914d\u4e3a central-m1\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"454\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-5.png\" alt=\"\" class=\"wp-image-516\"\/><\/figure>\n\n\n\n<p>hosted \u4ed3\u5e93\u4e00\u822c\u653e\u4f01\u4e1a\u81ea\u5df1\u7528\u7684\u4e0d\u5bf9\u5916\u7684 jar\u3002hosted \u4ed3\u5e93\u6709\u4e00\u4e2a\u5f88\u6709\u610f\u601d\u7684\u7528\u6cd5\uff0c\u5047\u8bbe\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a cq-hosted \u7684\u4ed3\u5e93\uff0c\u8be5\u4ed3\u5e93\u7684\u6240\u6709\u4f9d\u8d56\u663e\u7136\u5b58\u50a8\u5728 sonatype-work\/nexus\/storage\/cq-hosted\/ \u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"988\" height=\"58\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-6.png\" alt=\"\" class=\"wp-image-518\"\/><\/figure>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u7684\u601d\u7ef4\u6682\u65f6\u8df3\u8dc3\u4e00\u4e0b\uff1a\u5f53\u7528 maven \u4f5c\u4e3a\u6784\u5efa\u5de5\u5177\uff0c\u6784\u5efa\u5b8c\u6bd5\uff0c\u4f9d\u8d56\u4f1a\u6309\u7167 GAV \u63d0\u4f9b\u7684\u4fe1\u606f\u4ee5\u4e00\u5b9a\u7684\u7ed3\u6784\u5b58\u653e\u5728\u672c\u5730\uff08\u5982\u679c\u6ca1\u6709\u5728 ~\/.m2\/setting.xml \u4e2d\u8bbe\u7f6e\u8fc7 localRepository\uff0c\u5c31\u653e\u5728 ~\/.m2\/repository\/ \u4e0b\uff0c\u8fd9\u4e2a\u4ed3\u5e93\u5728 gadle \u4e2d\u901a\u8fc7 mavenLocal() \u6765\u5f15\u7528\uff09\u3002<\/p>\n\n\n\n<p>\u5b8c\u5168\u53ef\u4ee5\u76f4\u63a5\u5c06 ~\/.m2\/repository\/ \u4e0b\u7684\u5185\u5bb9\u539f\u5c01\u4e0d\u52a8\u5730\u62f7\u8d1d\u5230 sonatype-work\/nexus\/storage\/cq-hosted\/ \u4e0b\uff08\u7136\u540e\u5728 cq-hosted \u4ed3\u5e93\u4e0a update index\uff09\uff0c\u5c31\u53ef\u4ee5\u5c06\u672c\u5730\u4ed3\u5e93\u53d1\u5e03\u5230 cq-hosted \u4ed3\u5e93\uff0c\u4ed6\u4eec\u7684\u4f9d\u8d56\u8def\u5f84\u7ed3\u6784\u662f\u5b8c\u5168\u4e00\u6837\u7684\u3002\u518d\u5c06 cq-hosted \u4ed3\u5e93\u52a0\u5165 public \u4ed3\u5e93\u7ec4\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7 public \u4ed3\u5e93\u4f7f\u7528\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"402\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2021\/01\/image-7.png\" alt=\"\" class=\"wp-image-519\"\/><\/figure>\n\n\n\n<p>\u5bf9\u4e8e nexus-3\uff0c\u56e0\u4e3a\u5b58\u50a8\u91c7\u7528\u4e86 blob\uff0c\u6240\u4ee5\u662f\u4e0d\u652f\u6301\u8fd9\u6837\u76f4\u63a5\u62f7\u8d1d\u7684\u3002\u800c\u4f7f\u7528 gradle \u6765\u6784\u5efa\u7684\u8bdd\uff0c\u5b83\u5c06\u83b7\u53d6\u5230\u672c\u5730\u7684\u4f9d\u8d56\u89c6\u4e3a\u7f13\u5b58\uff0c\u5176 caches \u4e0b\u7684\u4f9d\u8d56\u8def\u5f84\u7ed3\u6784\u548c nexus-2 \u4e0a\u7684\u622a\u7136\u4e0d\u540c\uff08\u5f53\u7136\u4e5f\u662f\u5b58\u5728\u4e00\u5b9a\u7684\u5bf9\u5e94\u5173\u7cfb\uff0c\u4f46\u8fdc\u4e0d\u5982 maven \u65b9\u4fbf\uff09\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u79c1\u670d\u4e0d\u80fd\u8054\u7f51\uff0c\u90a3\u5982\u4e0a\u76f4\u63a5\u642c\u672c\u5730\u4ed3\u5e93\u4e5f\u662f\u53ef\u884c\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u8bfb\u53d6\u5f53\u524d\u8def\u5f84\u4e0b\u7684 pom.xml\uff0c\u5c06\u4f9d\u8d56 jar \u653e\u5230 .\/target\/dependency \u4e0b\uff0c\u5e76\u4fdd\u6301\u4e0b\u8f7d\u5230\u672c\u5730\u4ed3\u5e93\u65f6\u7684\u76ee\u5f55\u7ed3\u6784\nmvn -U -f .\/pom.xml -D mdep.copyPom=true -D mdep.addParentPoms=true -D outputAbsoluteArtifactFilename=true -D mdep.useRepositoryLayout=true dependency:copy-dependencies<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/help.sonatype.com\/repomanager2\/installing-and-running\/running\">\u5b98\u65b9\u53c2\u8003<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bb0\u5f97\u6700\u65e9\u8fdb\u884c web \u5f00\u53d1\u7684\u65f6\u5019\uff0c\u91c7\u7528 SSM \u67b6\u6784\uff0c\u4e00\u4e9b\u76f8\u5173\u7684 jar \u5305\u9700\u8981\u81ea\u884c\u5230\u5b98\u7f51\u4e0a\u641c\u7d22\u4e0b\u8f7d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=340"}],"version-history":[{"count":9,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions\/522"}],"wp:attachment":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}