{"id":352459,"date":"2021-02-16T03:11:15","date_gmt":"2021-02-15T19:11:15","guid":{"rendered":"http:\/\/4563.org\/?p=352459"},"modified":"2021-02-16T03:11:15","modified_gmt":"2021-02-15T19:11:15","slug":"%e5%85%b3%e4%ba%8e-java-%e4%b8%ad-maven-%e5%a4%9a%e6%a8%a1%e5%9d%97%e9%a1%b9%e7%9b%ae%e7%9a%84%e7%96%91%e9%97%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=352459","title":{"rendered":"\u5173\u4e8e Java \u4e2d maven \u591a\u6a21\u5757\u9879\u76ee\u7684\u7591\u95ee"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e Java \u4e2d maven \u591a\u6a21\u5757\u9879\u76ee\u7684\u7591\u95ee               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : woyao396 <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>1 \u3001maven \u591a\u6a21\u5757\u9879\u76ee\u4e3a\u4ec0\u4e48\u6709\u4eba\u6309\u670d\u52a1\u5206 \u53c8\u6709\u4eba\u6309\u4ee3\u7801\u5c42\u5206\uff1f <strong>\u54ea\u4e00\u79cd\u662f\u6700\u4f73\u5b9e\u8df5<\/strong><\/p>\n<p>\u6309\u670d\u52a1\u5206\uff1a<\/p>\n<ul>\n<li>xxx-user<\/li>\n<li>xxx-order<\/li>\n<li>xxx-search<\/li>\n<\/ul>\n<p>\u6309\u5c42\u5206\uff1a<\/p>\n<ul>\n<li>xxx-web<\/li>\n<li>xxx-service<\/li>\n<li>xxx-dao<\/li>\n<\/ul>\n<p>2 \u3001\u5047\u5982\u6309\u7b2c\u4e00\u79cd\u670d\u52a1\u5206\uff0c\u5982 github \u4e0a\u9ad8\u8fbe 46.4k star \u7684\u5546\u57ce\u9879\u76ee https:\/\/github.com\/macrozheng\/mall<\/p>\n<p>\u5b50\u6a21\u5757\u88ab\u6253\u5305\u540e\u3001\u4e0d\u540c jar \u5305\u4e2d \u4e2d<strong>\u5927\u91cf\u91cd\u590d<\/strong>\u7684 jar \u5305\u88ab\u5f15\u5165\uff08 spring \u7684 jar \u548c \u5b50\u6a21\u5757\u7684 jar \u5982 common \uff09 \u8fd9\u6837\u6253\u51fa\u7684\u5305\u6700\u540e\u4e0d\u662f\u5f88\u5927\uff1f\u8fd9\u96be\u9053\u5408\u7406\u5417\uff1f \u96be\u9053\u4e0d\u662f\u4e00\u4e2a jar \u88ab\u591a\u4e2a\u9879\u76ee\u5f15\u7528\u5417\uff1f<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210224_60361811cd78b.png\" alt=\"\u5173\u4e8e Java \u4e2d maven \u591a\u6a21\u5757\u9879\u76ee\u7684\u7591\u95ee\" \/><\/p>\n<p>3 \u3001\u6309\u5c42\u5206\u591a\u6a21\u5757\u7684\u610f\u4e49\u5230\u5e95\u5728\u54ea\uff1f\u7f51\u4e0a\u627e\u4e86\u5f88\u591a\u597d\u5904\u8bf4 \u611f\u89c9\u6ca1\u6709\u8bf4\u670d\u529b\u3002<\/p>\n<p>4 \u3001\u7236\u9879\u76ee\u628a\u6240\u6709\u5b50\u9879\u76ee\u90fd\u9700\u7684\u4f9d\u8d56\u653e\u5230<code>dependencyManagement<\/code>\u91cc\u5408\u9002\u5417\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>14<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5330434\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iyaozhen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4eec\u662f\u8fd9\u6837\u7684<br \/>1. \u6309\u6a21\u5757 \/\u670d\u52a1\u5206\uff0c\u751a\u81f3\u67d0\u4e9b\u5b50\u6a21\u5757\u662f\u8981\u72ec\u7acb\u90e8\u7f72\u7684\u670d\u52a1<br \/>2. \u8fd9\u5f88\u6b63\u5e38\u5440 mall-search \u3001mall-admin \u5c31\u662f\u4e24\u4e2a\u4e0d\u540c\u7684\u670d\u52a1\uff08\u72ec\u7acb\u8fd0\u884c\u7684 tomcat \u5b9e\u4f8b\u3001\u6216\u8005 docker \uff09\uff0c\u80af\u5b9a\u6709\u91cd\u590d\u7684<br \/>3. \u8fd9\u79cd\u6ca1\u592a\u89c1\u8fc7<br \/>4. parent pom \u4f9d\u8d56\u6709\u4e24\u79cd\uff0cdependencies \u8868\u793a\u90fd\u6709\u7684\u4f9d\u8d56\uff0c\u8fd9\u6837\u5b50 pom \u5c31\u4e0d\u7528\u91cd\u590d\u5b9a\u4e49\u4e86\u3002dependencyManagement \u662f parent \u58f0\u660e\u4e86\u7248\u672c\uff0c\u5b50 pom \u53ea\u9700\u8981\u914d\u7f6e groupId \u3001artifactId                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330435\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chendy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u6309\u6a21\u5757\u5206<br \/>2. \u4e0a\u767e M \u4f9d\u8d56+\u51e0\u767e K \u81ea\u5df1\u7684 class \u662f java \u9879\u76ee\u5e38\u6001\uff0c\u6709\u9700\u8981\u505a\u70b9\u955c\u50cf\u5206\u5c42\u4e4b\u7c7b\u7684\u4f18\u5316\u5c31\u884c<br \/>3. \u7eaf\u6ca1\u4e8b\u627e\u4e8b\uff0c\u52a0\u4e00\u4e2a\u63a5\u53e3\u76f4\u63a5\u6253\u7a7f\u597d\u51e0\u4e2a\u6a21\u5757\u4e00\u8d77\u6539\uff0c\u56fe\u4e2a\u5565<br \/>4. \u5408\u9002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330436\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : caixiaomao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e60\u60ef\u6309\u6a21\u5757\u5206 \u6e05\u6670\u4e00\u70b9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330437\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chippai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             user \u3001order \u662f\u4fe9\u4e2a\u9879\u76ee\u4e86<br \/>\u5355\u4e2a\u9879\u76ee\u662f\u4f1a\u5206 api \u3001service \u3001starter<br \/>&#8211; user-api (\u5bf9\u5916\u63d0\u4f9b RPC)\u3001<br \/>&#8211; user-serivce (\u670d\u52a1\u5b9e\u73b0 Provider)\u3001<br \/>&#8211; user-starter (springboot \u542f\u52a8\u5c42(\u5404\u79cd\u914d\u7f6e\u4fe1\u606f\u548c profile))                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330438\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6700\u8ba8\u538c\u591a\u6a21\u5757\u9879\u76ee\u4e86\u2026\u2026<\/p>\n<p>\u641e\u4e0d\u641e\u5fae\u670d\u52a1\uff0c\u90fd\u662f\u4e00\u4e2a\u6a21\u5757\u4e00\u4e2a\u9879\u76ee\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330439\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : urzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e00\u76f4\u5f88\u597d\u5947\u9009\u62e9\u591a\u6a21\u5757\u7684\u539f\u56e0\u662f\u4ec0\u4e48\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330440\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhady009 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4eec\u8fd9\u8fb9\u662f\u6253\u5305\u628a\u7b2c\u4e09\u65b9\u7684 jar \u548c\u6e90\u7801\u5206\u5f00 <br \/>\u4e91\u76d8\u4e0a\u9762\u5148\u628a\u7b2c\u4e09\u65b9\u7684 jar \u6309\u7167\u96c6\u7fa4\u5e94\u7528\u653e\u4e0a\u53bb<br \/>\u542f\u52a8\u53c2\u6570 classpath \u6307\u5b9a\u591a\u4e00\u4e2a\u5bf9\u5e94\u7684\u8def\u5f84\u5c31\u597d\u4e86 \u9664\u975e\u6709\u7b2c\u4e09\u65b9\u4f9d\u8d56\u66f4\u6539\u624d\u8981\u66f4\u65b0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330441\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sss666 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @urzz \u4ee3\u7801\u590d\u7528\uff0c\u9762\u5411 jar \u5305\u7f16\u7a0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330442\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ztechstack <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u6309\u7167\u670d\u52a1\u5206\uff0c\u591a\u6a21\u5757\u662f\u4e3a\u4e86\u591a\u4e2a\u670d\u52a1\u5171\u4eab\u67d0\u4e9b\u76f8\u540c\u7684\u4ee3\u7801\u3002<br \/>2. \u5f00\u53d1\u9636\u6bb5 maven \u662f\u4e00\u4e2a jar \u88ab\u591a\u4e2a\u9879\u76ee\u5f15\u7528\uff1b\u4f46\u6253\u5305\u7684\u65f6\u5019\u5982\u679c\u4e0d\u6253\u5305\u8fd9\u4e9b\u4f9d\u8d56\uff0c\u4f60\u9700\u8981\u4fdd\u8bc1\u5728\u5176\u4ed6\u673a\u5668\u90e8\u7f72\u7684\u65f6\u5019\uff0cclasspath \u4e0b\u9700\u8981\u6709\u4f60\u7528\u7684 jar\uff0c\u800c\u4e14\u9700\u8981\u4fdd\u8bc1\u7248\u672c\u4e0d\u80fd\u548c\u5176\u4ed6\u5de5\u7a0b\u51b2\u7a81\u3002<br \/>3. \u591a\u6a21\u5757\u5176\u5b9e\u5c31\u662f\u4e3a\u4e86\u5171\u4eab\u76f8\u540c\u7684\u4ee3\u7801\uff0c\u5047\u8bbe\u4e00\u4e2a\u5546\u57ce\uff0c\u6709\u5546\u54c1\u7cfb\u7edf\u3001\u8ba2\u5355\u7cfb\u7edf\u3001\u652f\u4ed8\u7cfb\u7edf\uff0c\u5f88\u591a\u4ee3\u7801\u53ef\u4ee5\u5171\u4eab\uff1b<br \/>\u5176\u5b9e\u6211\u89c9\u5f97\u5355\u72ec\u6253\u5305 jar+\u7248\u672c\u7ba1\u7406\uff0c\u624d\u662f\u6bd4\u8f83\u597d\u7684\u9009\u62e9\u3002<br \/>4. \u5408\u9002\uff0c\u9996\u5148\u5b50\u9879\u76ee\u4e0d\u9700\u8981\u4e9b version\uff0c\u9996\u5148\u53ef\u4ee5\u4fdd\u8bc1\u7248\u672c\u4e00\u76f4\uff0c\u800c\u4e14\u5728\u7248\u672c\u5347\u7ea7\uff08\u6709\u6f0f\u6d1e\u7684\u65f6\u5019\uff09\u53ef\u4ee5\u4fdd\u8bc1\u5927\u5bb6\u90fd\u5347\u4e0a\u6765\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330443\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iseki <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u4ec0\u4e48\u6253\u5305\u5168\u8fbe\u6210 fat-jar \u3002\u3002\u3002\u5b9e\u9645\u4e0a\u4f60\u770b\u770b\u6bcf\u4e2a\u72ec\u7acb\u8fd0\u884c\u7684 fat-jar \u5e76\u4e0d\u4f1a\u91cd\u590d\u5305\u542b jar \u4f5c\u4e3a lib\uff0c\u5728\u5b9e\u9645\u4e2d\u8fd9\u4e5f\u662f\u6ca1\u5fc5\u8981\u7684\uff08\u9664\u975e\u4f60\u901a\u8fc7\u7c7b\u52a0\u8f7d\u5668\uff08\u4f60\u4e0d\u80fd\u91cd\u590d\u52a0\u8f7d\u540c\u4e00\u4e2a\u7c7b\uff09\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330444\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5206\u5f97\u592a\u7ec6\uff0c\u7ba1\u7406\u4e5f\u662f\u4e00\u6837\u95ee\u9898\u3002\u66fe\u7ecf\u4e00\u4e2a\u9879\u76ee\u5206\u7684 Maven Module \u591a\u8fbe 40 \u4e2a\u3002<\/p>\n<p>\u73b0\u5728\u7684\u7ecf\u9a8c\u662f\uff0c\u9664\u975e\u6bcf\u4e2a Module \u662f\u5355\u72ec\u90e8\u7f72\uff0c\u5426\u5219\u4e0d\u5206\u3002<\/p>\n<p>\u4e0d\u540c\u7684\uff08\u5355\u72ec\u90e8\u7f72\u7684\uff09 Moudle \u4e4b\u95f4\u6709\u4e9b\u7c7b\u9700\u8981\u5171\u4eab\uff0c\u62bd\u51fa\u4e00\u4e2a\u5171\u4eab\u7684 Module\uff0c\u5982\u4e00\u4e9b\u7b80\u5355\u7684 Dtos \uff08\u7528\u4e8e\u7edf\u4e00 Caller \u4e0e Callee \u4e4b\u95f4\u7684\u683c\u5f0f\uff09\u7b49\uff0c\u6c38\u8fdc\u4e0d\u8981\u5171\u4eab\u6570\u636e\u5e93\u7b49\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330445\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u591a\u6a21\u5757 Parent\/Child \u4f9d\u8d56\u5904\u7406\u65f6\uff0c\u5c06\u6240\u6709\u7684\u9879\u76ee\u7684\u4f9d\u8d56\u5b9a\u4e49\u5728 dependencyManagement \u4e2d\uff0c\u7edf\u4e00\u7ba1\u7406\u9879\u76ee\u6240\u6709\u4f9d\u8d56\uff0c\u6700\u9876\u5c42\u7684 parent module \u5728\u9879\u76ee\u4e2d\u4f5c\u4e3a\u4e00\u4e2a BOM \u5b58\u5728\uff0c\u4e0d\u8981\u5c06\u6dfb\u52a0\u4efb\u4f55 dependencies\uff0cdependencies \u4e0b\u6240\u6709\u7684\u4f9d\u8d56\u58f0\u660e\u4f1a\u6c61\u67d3\u6240\u6709 Module \u3002<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u903b\u8f91\u5355\u5143\u4e0b Module\uff0c\u5982\u4e0b\u7ed3\u6784\uff0corder-parent \u5b58\u5728\u7236\u5b50\u7ed3\u6784\uff0c\u6839\u636e\u60c5\u51b5\u53ef\u4ee5\u5728\u7236 pom \u8003\u8651\u6dfb\u52a0 dependencies \u3002<\/p>\n<p>parent<br \/>&#8212;<br \/>&#8212;<br \/>&#8211;order-parent<br \/>&#8212; order-api<br \/>&#8212; order-model                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330446\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Joker123456789 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6309\u670d\u52a1\u5206\u7684\u9879\u76ee \u4e00\u822c\u662f\u5fae\u670d\u52a1\u9879\u76ee\uff0c\u4f60\u53ef\u4ee5\u5c55\u5f00\u770b\u770b\uff0c\u6bcf\u4e2a\u670d\u52a1\u91cc\u9762\u4f30\u8ba1\u90fd\u5206\u4e86 \u5c42\u7684\uff0c\u4e5f\u5c31\u662f web\uff0cservice \u8fd9\u4e9b\uff0c\u4e0d\u8fc7\u4e0d\u4e00\u5b9a\u662f\u7528\u6a21\u5757\u6765\u5206\u5c42\uff0c\u4e5f\u6709\u7528 \u5305 \u5206\u5c42\u7684\u3002<\/p>\n<p>\u6309\u5c42\u5206\u7684 \u57fa\u672c\u662f\u5355\u4f53\u9879\u76ee\uff0c\u4e1a\u52a1\u6a21\u5757\u4e0d\u591a\uff0c\u5e76\u53d1\u91cf\u4e0d\u5927\uff0c\u4f46\u662f\u4ee3\u7801\u6709\u70b9\u591a\uff0c\u5c31\u5e72\u8106\u7528\u6a21\u5757\u6765\u5206\u5c42\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5330447\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SkyLine7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4eec\u4e24\u79cd 2 \u79cd\u7ed3\u5408\u7528\u7684\uff0c\u670d\u52a1\u5206\u5b50 pom\uff0c\u91cc\u9762\u518d\u6309\u4e09\u5c42\u7ed3\u6784\u5206                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e Java \u4e2d maven \u591a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/352459"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=352459"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/352459\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352459"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}