{"id":1842,"date":"2025-07-01T11:10:50","date_gmt":"2025-07-01T03:10:50","guid":{"rendered":"https:\/\/diuut.com\/?p=1842"},"modified":"2025-11-13T17:28:42","modified_gmt":"2025-11-13T09:28:42","slug":"windosw%e7%8e%af%e5%a2%83%e6%9c%ac%e5%9c%b0maven%e4%bb%93%e5%ba%93%e4%b8%8a%e4%bc%a0nexus%e7%a7%81%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=1842","title":{"rendered":"\u672c\u5730Maven\u4ed3\u5e93\u6279\u91cf\u4e0a\u4f20Nexus\u79c1\u670d"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u9700\u6c42<\/p><cite>\u79c1\u670d\u642d\u597d\u4e86\uff0c\u4f46\u6ca1\u5916\u7f51\u4ee3\u7406\u7528\u4e0d\u4e86\uff0c\u53ea\u80fd\u81ea\u5df1\u672c\u5730\u4ed3\u5e93\u4f20\u8fdb\u53bb<\/cite><\/blockquote>\n\n\n\n<p>\u672c\u5730\u9700\u8981\u63d0\u524d<strong>\u51c6\u5907<\/strong>\u597dmaven\uff0c\u548cgit\uff08\u7528\u4e8e\u6267\u884cshell\u811a\u672c\uff09\uff0c\u4ee5\u53caNexus\u79c1\u670d<\/p>\n\n\n\n<p>\u6253\u5f00\u672c\u5730maven\u4ed3\u5e93\uff0c\u4f8b\u5982 D:\/Repository\uff0c\u5728\u8be5\u76ee\u5f55\u4e0b\u521b\u5efa\u4e24\u4e2a\u6587\u4ef6\uff0c\u5982\u4e0b<\/p>\n\n\n\n<p><strong>\u7b2c\u4e00\u4e2a<\/strong>\uff1amavenimport.sh <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n# copy and run this script to the root of the repository directory containing files\n# this script attempts to exclude uploading itself explicitly so the script name is important\n# Get command line params\nwhile getopts &quot;:r:u:p:&quot; opt; do\n\tcase $opt in\n\t\tr) REPO_URL=&quot;$OPTARG&quot;\n\t\t;;\n\t\tu) USERNAME=&quot;$OPTARG&quot;\n\t\t;;\n\t\tp) PASSWORD=&quot;$OPTARG&quot;\n\t\t;;\n\tesac\ndone\n \nfind . -type f -not -path '.\/mavenimport\\.sh*' -not -path '*\/\\.*' -not -path '*\/\\^archetype\\-catalog\\.xml*' -not -path '*\/\\^maven\\-metadata\\-local*\\.xml' -not -path '*\/\\^maven\\-metadata\\-deployment*\\.xml' | sed &quot;s|^\\.\/||&quot; | xargs -I '{}' curl -u &quot;$USERNAME:$PASSWORD&quot; -X PUT -v -T {} ${REPO_URL}\/{} ;\n<\/pre><\/div>\n\n\n<p><strong>\u7b2c\u4e8c<\/strong>\uff1a<br>\u5982\u679c\u662fwindows\u73af\u5883\u5c31\u7b2c\u4e8c\u79cd\u4f7f\u7528runGit.sh<br>[username] \u66ff\u6362\u4e3anexus\u6709\u4e0a\u4f20\u6743\u9650\u7684\u8d26\u6237\u540d<br>[password]\u66ff\u6362\u4e3anexus\u6709\u4e0a\u4f20\u6743\u9650\u8d26\u6237\u5bc6\u7801<br>[url]\u66ff\u6362\u95eeNexus\u79c1\u670d\u4ed3\u5e93\u8def\u5f84\uff08\u767b\u5f55Nexus\u79c1\u670d-Browse-\u9009\u62e9\u5bf9\u5e94\u4ed3\u5e93-URL\u5217\u70b9\u51fb[copy]\uff09<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n.\/mavenimport.sh -u &#91;username]-p &#91;password] -r &#91;url]\n\n<\/pre><\/div>\n\n\n<p>\u6587\u4ef6\u51c6\u5907\u5b8c\u6bd5\uff0c\u53f3\u952e-\u6253\u5f00\u4e00\u4e2agit-bash\u7a97\u53e3\uff0c\u5982\u679c\u6253\u5f00\u7684\u975e\u5f53\u524d\u4ed3\u5e93\u8def\u5f84D:\/Repository\u4e0b\uff0c\u5206\u522b\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncd d:\n#\u79fb\u52a8\u5230D\u76d8\ncd Repository\n#\u79fb\u52a8\u5230Repository\u76ee\u5f55\n.\/runGit.sh\n#\u542f\u52a8\u4e0a\u4f20\u811a\u672c\u540e\u5c31\u53ef\u4ee5\u7b49\u5f85\u4e0a\u4f20\u4e86\n<\/pre><\/div>\n\n\n<p>\u5982\u679c\u662f\u5728linux\u73af\u5883\u4e2d\u5219\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528mavenimport.sh<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsh \/app\/maven-repository\/maven-repository\/mavenimport.sh -u admin -p admin -r http:\/\/127.0.0.1:8081\/repository\/i17-maven-hosted\/\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u79c1\u670d\u642d\u597d\u4e86\uff0c\u4f46\u6ca1\u5916\u7f51\u4ee3\u7406\u7528\u4e0d\u4e86\uff0c\u53ea\u80fd\u81ea\u5df1\u672c\u5730\u4ed3\u5e93\u4f20\u8fdb\u53bb \u672c\u5730\u9700\u8981\u63d0\u524d\u51c6\u5907\u597dmaven\uff0c\u548cgit\uff08\u7528\u4e8e\u6267\u884c<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=1842\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">\u672c\u5730Maven\u4ed3\u5e93\u6279\u91cf\u4e0a\u4f20Nexus\u79c1\u670d<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1840,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[74,73],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1842"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1842"}],"version-history":[{"count":3,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1842\/revisions"}],"predecessor-version":[{"id":1856,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1842\/revisions\/1856"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/1840"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}