{"id":314222,"date":"2024-05-20T23:27:07","date_gmt":"2024-05-20T15:27:07","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/314222.html"},"modified":"2024-05-20T23:27:31","modified_gmt":"2024-05-20T15:27:31","slug":"%e5%bc%95%e5%85%a5-cloud-%e5%8c%85%e7%9a%84%e6%96%b9%e6%b3%95%e6%9c%89%e5%93%aa%e4%ba%9b","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/314222.html","title":{"rendered":"\u5f15\u5165 cloud \u5305\u7684\u65b9\u6cd5\u6709\u54ea\u4e9b"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27033706\/891552de-196e-4371-ab84-e6ba2c1ac1cf.webp\" alt=\"\u5f15\u5165 cloud \u5305\u7684\u65b9\u6cd5\u6709\u54ea\u4e9b\" \/><\/p>\n<p><p>\u5f15\u5165cloud\u5305\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a<strong>\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u3001\u76f4\u63a5\u4e0b\u8f7d\u4e91\u5305\u3001\u901a\u8fc7CDN\u5f15\u5165<\/strong>\u3001\u548c<strong>\u4f7f\u7528\u6784\u5efa\u5de5\u5177\u96c6\u6210<\/strong>\u3002\u5bf9\u4e8e<strong>\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b89\u88c5<\/strong>\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u6d41\u884c\u4e14\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u5408\u5728\u73b0\u4ee3web\u5f00\u53d1\u4e2d\u4f7f\u7528\u3002\u5b83\u5141\u8bb8\u5f00\u53d1\u8005\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\u884c\u64cd\u4f5c\u5b89\u88c5\u3001\u66f4\u65b0\u6216\u8005\u79fb\u9664\u67d0\u4e2a\u5305\uff0c\u6781\u5927\u5730\u7b80\u5316\u4e86\u5305\u7684\u7ba1\u7406\u8fc7\u7a0b\u3002\u5305\u7ba1\u7406\u5668\u5982npm\u3001Yarn\u7b49\uff0c\u80fd\u591f\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u89e3\u51b3\u5305\u4e4b\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u81ea\u52a8\u4e0b\u8f7d\u6240\u9700\u7684\u6240\u6709\u4f9d\u8d56\u9879\uff0c\u4fdd\u8bc1\u9879\u76ee\u7684\u5305\u7248\u672c\u7edf\u4e00\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387\u548c\u9879\u76ee\u8d28\u91cf\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b89\u88c5<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u662f\u73b0\u4ee3\u5f00\u53d1\u4e2d\u5e38\u89c1\u7684\u4e00\u79cd\u65b9\u6cd5\uff0c\u5b83\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u8f7b\u677e\u5730\u6dfb\u52a0\u3001\u66f4\u65b0\u548c\u79fb\u9664\u9879\u76ee\u6240\u4f9d\u8d56\u7684\u5e93\u3002\u6bd4\u8f83\u6d41\u884c\u7684\u5305\u7ba1\u7406\u5668\u6709<strong>npm<\/strong>\u548c<strong>Yarn<\/strong>\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u5bf9\u4e8e<strong>\u4f7f\u7528npm<\/strong>\uff0c\u9996\u5148\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Node.js\uff0c\u56e0\u4e3anpm\u662f\u968fNode.js\u4e00\u8d77\u5b89\u88c5\u7684\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u4f7f\u7528<code>npm install &lt;\u5305\u540d\u79f0&gt;<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u6240\u9700\u7684cloud\u5305\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u5b89\u88c5\u4e00\u4e2a\u540d\u4e3a<code>cloud-sdk<\/code>\u7684\u5305\uff0c\u53ea\u9700\u8981\u8f93\u5165<code>npm install cloud-sdk<\/code>\u5373\u53ef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Yarn<\/strong>\u5b89\u88c5\u5305\u4e5f\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u7ecf\u5728\u7535\u8111\u4e0a\u5b89\u88c5\u4e86Yarn\u3002\u548cnpm\u7c7b\u4f3c\uff0c\u4f7f\u7528Yarn\u5b89\u88c5\u5305\u53ea\u9700\u8981\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u8f93\u5165<code>yarn add &lt;\u5305\u540d\u79f0&gt;<\/code>\u3002\u4f8b\u5982\uff0c<code>yarn add cloud-sdk<\/code>\u4f1a\u5c06<code>cloud-sdk<\/code>\u5305\u6dfb\u52a0\u5230\u4f60\u7684\u9879\u76ee\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u8fd9\u4e24\u79cd\u5305\u7ba1\u7406\u5668\u90fd\u652f\u6301\u5c06\u5305\u7684\u4fe1\u606f\u4fdd\u5b58\u5230\u4e00\u4e2a\u540d\u4e3a<code>package.json<\/code>\u7684\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u8fd9\u6837\uff0c\u5176\u4ed6\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u7b80\u5355\u7684\u547d\u4ee4\uff08<code>npm install<\/code>\u6216<code>yarn<\/code>\uff09\uff0c\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u6240\u6709\u4f9d\u8d56\u5305\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u76f4\u63a5\u4e0b\u8f7d\u4e91\u5305<\/h2>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u5f15\u5165cloud\u5305\u7684\u65b9\u6cd5\u662f\u76f4\u63a5\u4ece\u4e92\u8054\u7f51\u4e0a\u4e0b\u8f7d\u5305\u7684\u6e90\u4ee3\u7801\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u90a3\u4e9b\u65e0\u6cd5\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u627e\u5230\u6240\u9700\u5305\uff0c\u6216\u8005\u9700\u8981\u4fee\u6539\u5305\u6e90\u4ee3\u7801\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u4f60\u9700\u8981\u627e\u5230\u5305\u7684\u5b98\u65b9\u7f51\u7ad9\u6216\u8005\u6e90\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff08\u5982GitHub\u3001GitLab\u7b49\uff09\u3002<\/li>\n<li>\u7136\u540e\uff0c\u6839\u636e\u7f51\u7ad9\u4e0a\u63d0\u4f9b\u7684\u6307\u793a\u4e0b\u8f7d\u6240\u9700\u7248\u672c\u7684\u5305\u3002\u4e0b\u8f7d\u7684\u5f62\u5f0f\u53ef\u80fd\u662fZIP\u538b\u7f29\u5305\u6216\u8005\u5176\u4ed6\u683c\u5f0f\u3002<\/li>\n<li>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u5c06\u538b\u7f29\u5305\u89e3\u538b\u5e76\u5c06\u5305\u7684\u5185\u5bb9\u653e\u7f6e\u5230\u9879\u76ee\u7684\u76f8\u5e94\u4f4d\u7f6e\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4f60\u53ef\u80fd\u8fd8\u9700\u8981\u624b\u52a8\u89e3\u51b3\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\u3002<\/li>\n<\/ul>\n<p><p>\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u7ed9\u4e86\u5f00\u53d1\u8005\u6700\u5927\u7684\u7075\u6d3b\u6027\uff0c\u4f46\u5b83\u4e5f\u8981\u6c42\u5f00\u53d1\u8005\u6709\u66f4\u9ad8\u7684\u6280\u672f\u6839\u57fa\u548c\u5bf9\u5305\u4f9d\u8d56\u6027\u7684\u6df1\u5165\u7406\u89e3\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u901a\u8fc7CDN\u5f15\u5165<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528CDN\uff08\u5185\u5bb9\u5206\u53d1\u7f51\u7edc\uff09\u5f15\u5165cloud\u5305\u662f\u4e00\u79cd\u5feb\u901f\u4e14\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u5408\u90a3\u4e9b\u9762\u5411\u524d\u7aef\u7684\u5e93\u3002\u8fd9\u79cd\u65b9\u6cd5\u901a\u8fc7\u5728HTML\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u6307\u5411CDN\u4e0a\u7684\u5305\u7684<code>&lt;script&gt;<\/code>\u6807\u7b7e\u6765\u5de5\u4f5c\u3002<\/p>\n<\/p>\n<ul>\n<li>\u9009\u62e9\u4e00\u4e2a\u63d0\u4f9b\u6240\u9700cloud\u5305CDN\u94fe\u63a5\u7684\u670d\u52a1\u3002\u5e38\u89c1\u7684CDN\u670d\u52a1\u6709unpkg\u3001jsDelivr\u7b49\u3002<\/li>\n<li>\u8bbf\u95ee\u8fd9\u4e9bCDN\u670d\u52a1\u7684\u7f51\u7ad9\uff0c\u641c\u7d22\u6240\u9700\u7684cloud\u5305\u5e76\u627e\u5230\u6700\u65b0\u7248\u672c\u7684\u94fe\u63a5\u3002<\/li>\n<li>\u5c06\u8fd9\u4e2a\u94fe\u63a5\u4f5c\u4e3a<code>&lt;script&gt;<\/code>\u6807\u7b7e\u7684<code>src<\/code>\u5c5e\u6027\u503c\u6dfb\u52a0\u5230\u4f60\u7684HTML\u6587\u4ef6\u4e2d\u3002\u8fd9\u6837\uff0c\u5f53\u9875\u9762\u52a0\u8f7d\u65f6\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u4eceCDN\u4e0b\u8f7d\u5e76\u6267\u884c\u8fd9\u4e2a\u5305\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7CDN\u5f15\u5165\u7684\u4e3b\u8981\u4f18\u70b9\u662f\u53ef\u4ee5\u6781\u5927\u5730\u63d0\u5347\u9875\u9762\u52a0\u8f7d\u901f\u5ea6\uff0c\u7279\u522b\u662f\u5f53\u591a\u4e2a\u7f51\u7ad9\u4f7f\u7528\u540c\u4e00\u4e2aCDN\u670d\u52a1\u65f6\uff0c\u6d4f\u89c8\u5668\u53ef\u4ee5\u5171\u4eab\u7f13\u5b58\u7684\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528\u6784\u5efa\u5de5\u5177\u96c6\u6210<\/h2>\n<\/p>\n<p><p>\u5bf9\u4e8e\u590d\u6742\u7684\u9879\u76ee\uff0c\u5c24\u5176\u662f\u9700\u8981\u8fdb\u884c\u4ee3\u7801\u4f18\u5316\u3001\u6a21\u5757\u5408\u5e76\u7684\u9879\u76ee\u6765\u8bf4\uff0c\u4f7f\u7528\u6784\u5efa\u5de5\u5177\u8fdb\u884ccloud\u5305\u7684\u96c6\u6210\u662f\u975e\u5e38\u5fc5\u8981\u7684\u3002\u5e38\u89c1\u7684\u6784\u5efa\u5de5\u5177\u6709Webpack\u3001Rollup\u3001Parcel\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>\u4f7f\u7528Webpack<\/strong>\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e<code>webpack.config.js<\/code>\u6587\u4ef6\uff0c\u6765\u6307\u5b9a\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u6a21\u5757\u548c\u5e93\u3002Webpack\u80fd\u591f\u5904\u7406\u9879\u76ee\u4e2d\u7684\u5404\u79cd\u8d44\u6e90\uff0c\u5305\u62ecJS\u3001CSS\u3001\u56fe\u7247\u7b49\uff0c\u5e76\u4e14\u652f\u6301\u6a21\u5757\u5316\u6253\u5305\u3002<\/li>\n<li><strong>Rollup<\/strong>\u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684JavaScript\u6a21\u5757\u6253\u5305\u5668\uff0c\u7279\u522b\u9002\u5408\u7528\u4e8e\u5e93\u548c\u5e94\u7528\u7684\u7f16\u8bd1\u3002\u5b83\u652f\u6301\u5c06\u5c0f\u5757\u4ee3\u7801\u7f16\u8bd1\u6210\u66f4\u5927\u7684\u7247\u6bb5\uff0c\u5bf9\u4ee3\u7801\u8fdb\u884c\u4f18\u5316\u3002<\/li>\n<li><strong>Parcel<\/strong>\u4ee5\u5176\u96f6\u914d\u7f6e\u7684\u7279\u6027\u8457\u79f0\uff0c\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5feb\u901f\u3001\u7b80\u5355\u7684\u6253\u5305\u5de5\u5177\uff0c\u81ea\u52a8\u5904\u7406\u590d\u6742\u7684\u914d\u7f6e\u95ee\u9898\u3002<\/li>\n<\/ul>\n<p><p>\u4f7f\u7528\u6784\u5efa\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u81ea\u52a8\u5316\u5904\u7406\u4f9d\u8d56\u7ba1\u7406\uff0c\u4f18\u5316\u4ee3\u7801\uff0c\u63d0\u5347\u9879\u76ee\u7684\u6027\u80fd\u548c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u8fd9\u56db\u79cd\u65b9\u6cd5\u5404\u6709\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u548c\u4e2a\u4eba\u504f\u597d\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u5f0f\u5f15\u5165cloud\u5305\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. cloud \u5305\u7684\u5f15\u5165\u65b9\u6cd5\u6709\u54ea\u4e9b\uff1f<\/strong><\/p>\n<ul>\n<li>\u900f\u8fc7 Maven \u5de5\u5177\u5c06 cloud \u5305\u5f15\u5165\u9879\u76ee\u4e2d\uff0c\u53ef\u901a\u8fc7\u5728\u9879\u76ee\u7684 pom.xml \u6587\u4ef6\u4e2d\u6dfb\u52a0\u76f8\u5173\u4f9d\u8d56\u9879\u6765\u5b9e\u73b0\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a\n<ul>\n<li>\u6253\u5f00\u9879\u76ee\u7684 pom.xml \u6587\u4ef6\u3002<\/li>\n<li>\u5728  \u6807\u7b7e\u4e2d\u6dfb\u52a0 cloud \u76f8\u5173\u7684\u4f9d\u8d56\u9879\u3002<\/li>\n<li>\u4fdd\u5b58\u5e76\u5237\u65b0 Maven \u9879\u76ee\uff0c\u4f7f\u5176\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5f15\u5165\u6240\u9700\u7684 cloud \u5305\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>2. \u6211\u53ef\u4ee5\u624b\u52a8\u5f15\u5165 cloud \u5305\u5417\uff1f<\/strong><br \/>\n\u662f\u7684\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u4e0b\u8f7d\u5e76\u5f15\u5165 cloud \u5305\u5230\u9879\u76ee\u4e2d\uff0c\u800c\u4e0d\u4f9d\u8d56 Maven \u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u624b\u52a8\u5f15\u5165 cloud \u5305\u7684\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u5728\u5b98\u65b9\u7f51\u7ad9\u6216\u5176\u4ed6\u53ef\u9760\u4e0b\u8f7d\u6e90\u4e2d\u627e\u5230\u6240\u9700\u7684 cloud \u5305\u3002<\/li>\n<li>\u4e0b\u8f7d\u6240\u9700\u7684 cloud \u5305\uff0c\u5e76\u5c06\u5176\u590d\u5236\u5230\u9879\u76ee\u7684\u5408\u9002\u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u5728\u9879\u76ee\u7684\u6784\u5efa\u8def\u5f84\u4e2d\u6dfb\u52a0 cloud \u5305\u7684\u8def\u5f84\uff0c\u786e\u4fdd\u9879\u76ee\u80fd\u591f\u627e\u5230\u5e76\u6b63\u786e\u4f7f\u7528\u5b83\u3002<\/li>\n<\/ul>\n<p><strong>3. \u6211\u53ef\u4ee5\u4f7f\u7528 Gradle \u5f15\u5165 cloud \u5305\u5417\uff1f<\/strong><br \/>\n\u662f\u7684\uff0c\u9664\u4e86\u4f7f\u7528 Maven \u5de5\u5177\u548c\u624b\u52a8\u5f15\u5165\u4e4b\u5916\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 Gradle \u6784\u5efa\u5de5\u5177\u6765\u5f15\u5165 cloud \u5305\u5230\u9879\u76ee\u4e2d\u3002\u4e0b\u9762\u662f\u4f7f\u7528 Gradle \u5f15\u5165 cloud \u5305\u7684\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00\u9879\u76ee\u7684 build.gradle \u6587\u4ef6\u3002<\/li>\n<li>\u5728 dependencies \u90e8\u5206\u6dfb\u52a0 cloud \u76f8\u5173\u7684\u4f9d\u8d56\u9879\u3002<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u8fd0\u884c Gradle \u6784\u5efa\uff0c\u4f7f\u5176\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5f15\u5165\u6240\u9700\u7684 cloud \u5305\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u5f15\u5165cloud\u5305\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u3001\u76f4\u63a5\u4e0b\u8f7d\u4e91\u5305\u3001\u901a\u8fc7CDN\u5f15\u5165\u3001\u548c\u4f7f\u7528\u6784\u5efa\u5de5\u5177\u96c6\u6210\u3002\u5bf9\u4e8e\u901a [&hellip;]","protected":false},"author":3,"featured_media":314252,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/314222"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=314222"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/314222\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/314252"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=314222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=314222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=314222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}