{"id":6869,"date":"2025-09-30T10:41:15","date_gmt":"2025-09-30T02:41:15","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6869"},"modified":"2025-09-30T10:41:15","modified_gmt":"2025-09-30T02:41:15","slug":"%e5%90%8c%e4%b8%ba%e4%be%9d%e8%b5%96%e7%ae%a1%e7%90%86%e6%ba%90%ef%bc%8ccocoapods-spec-%e6%ba%90%e5%af%b9%e6%af%94-maven-%e6%ba%90%e4%bc%98%e5%8a%a3%e5%8a%bf","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6869","title":{"rendered":"\u540c\u4e3a\u4f9d\u8d56\u7ba1\u7406\u6e90\uff0cCocoaPods spec \u6e90\u5bf9\u6bd4 maven \u6e90\u4f18\u52a3\u52bf"},"content":{"rendered":"<p>CocoaPods spec \u6e90\uff08iOS\/macOS \u751f\u6001\uff09\u548c Maven \u6e90\uff08Java\/Android \u751f\u6001\uff09\u4f5c\u4e3a\u4e0d\u540c\u5305\u7ba1\u7406\u4f53\u7cfb\u7684\u4f9d\u8d56\u4ed3\u5e93\uff0c\u5728\u8bbe\u8ba1\u7406\u5ff5\u3001\u529f\u80fd\u7279\u6027\u548c\u9002\u7528\u573a\u666f\u4e0a\u5b58\u5728\u663e\u8457\u5dee\u5f02\uff0c\u5404\u81ea\u7684\u4f18\u52a3\u52bf\u5982\u4e0b\uff1a<\/p>\n<h3><strong>\u4e00\u3001\u6838\u5fc3\u5dee\u5f02\u4e0e\u4f18\u52bf\u5bf9\u6bd4<\/strong><\/h3>\n<h4><strong>1. CocoaPods spec \u6e90\u7684\u4f18\u52bf<\/strong><\/h4>\n<ul>\n<li>\n<p><strong>\u8f7b\u91cf\u7ea7\u8bbe\u8ba1\uff0c\u805a\u7126\u7ec4\u4ef6\u63cf\u8ff0<\/strong><br \/>\nCocoaPods \u6e90\u672c\u8d28\u662f <strong>Git \u4ed3\u5e93<\/strong>\uff0c\u4ec5\u5b58\u50a8 <code>.podspec<\/code> \u6587\u4ef6\uff08\u7ec4\u4ef6\u7684\u5143\u6570\u636e\u63cf\u8ff0\uff0c\u5982\u7248\u672c\u3001\u6e90\u7801\u5730\u5740\u3001\u4f9d\u8d56\u5173\u7cfb\u7b49\uff09\uff0c\u4e0d\u76f4\u63a5\u5b58\u50a8\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002\u8fd9\u79cd\u8bbe\u8ba1\u7684\u4f18\u52bf\uff1a  <\/p>\n<ul>\n<li>\u6e90\u4ed3\u5e93\u4f53\u79ef\u5c0f\uff08\u7eaf\u6587\u672c\u63cf\u8ff0\uff09\uff0c\u514b\u9686\u548c\u66f4\u65b0\u901f\u5ea6\u5feb\uff08\u5c24\u5176\u521d\u671f\u4f7f\u7528\u65f6\uff09\uff1b  <\/li>\n<li>\u7ec4\u4ef6\u6e90\u7801\/\u4e8c\u8fdb\u5236\u5305\u76f4\u63a5\u6307\u5411\u5916\u90e8 Git \u4ed3\u5e93\u6216 CDN\uff0c\u907f\u514d\u6e90\u4ed3\u5e93\u5b58\u50a8\u538b\u529b\uff1b  <\/li>\n<li>\u6613\u4e8e\u901a\u8fc7 Git \u539f\u751f\u529f\u80fd\uff08\u5206\u652f\u3001Tag\u3001PR\uff09\u7ba1\u7406 spec \u7248\u672c\u53d8\u66f4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5f3a\u7ed1\u5b9a Xcode \u751f\u6001\uff0c\u9002\u914d\u6027\u597d<\/strong><br \/>\n\u4e13\u4e3a iOS\/macOS \u5f00\u53d1\u8bbe\u8ba1\uff0c<code>.podspec<\/code> \u652f\u6301 Xcode \u7279\u6709\u7684\u914d\u7f6e\uff08\u5982\u7f16\u8bd1\u9009\u9879\u3001\u8d44\u6e90\u6587\u4ef6\u5904\u7406\u3001\u67b6\u6784\u652f\u6301\u7b49\uff09\uff0c\u80fd\u7cbe\u51c6\u9002\u914d Apple \u5f00\u53d1\u5de5\u5177\u94fe\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-ruby\">s.xcconfig = { \"HEADER_SEARCH_PATHS\" => \"$(SDKROOT)\/usr\/include\/libxml2\" }  # Xcode \u7f16\u8bd1\u914d\u7f6e\ns.resource_bundles = { \"MyResources\" => [\"Resources\/*.png\"] }  # \u8d44\u6e90\u6587\u4ef6\u5904\u7406<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u7075\u6d3b\u7684\u4f9d\u8d56\u89e3\u6790\uff0c\u652f\u6301\u591a\u7248\u672c\u5171\u5b58<\/strong><br \/>\n\u5141\u8bb8\u5728\u540c\u4e00\u9879\u76ee\u4e2d\u901a\u8fc7 <code>subspec<\/code> \u62c6\u5206\u7ec4\u4ef6\u529f\u80fd\uff08\u5982\u4e00\u4e2a SDK \u62c6\u5206\u4e3a\u6838\u5fc3\u5e93\u548c\u6269\u5c55\u5e93\uff09\uff0c\u5e76\u652f\u6301\u4e0d\u540c\u5b50\u6a21\u5757\u4f9d\u8d56\u4e0d\u540c\u7248\u672c\u7684\u57fa\u7840\u5e93\uff0c\u7075\u6d3b\u6027\u66f4\u9ad8\u3002<\/p>\n<\/li>\n<\/ul>\n<h4><strong>2. Maven \u6e90\u7684\u4f18\u52bf<\/strong><\/h4>\n<ul>\n<li>\n<p><strong>\u5168\u91cf\u5b58\u50a8\uff0c\u5b8c\u6574\u6027\u9ad8<\/strong><br \/>\nMaven \u6e90\u662f <strong>\u4e8c\u8fdb\u5236\u4ed3\u5e93<\/strong>\uff0c\u4e0d\u4ec5\u5b58\u50a8\u5143\u6570\u636e\uff08<code>pom.xml<\/code>\uff09\uff0c\u8fd8\u76f4\u63a5\u5b58\u50a8\u4e8c\u8fdb\u5236\u6587\u4ef6\uff08<code>.jar<\/code>\/<code>.aar<\/code>\uff09\uff0c\u5f62\u6210\u5b8c\u6574\u7684\u4f9d\u8d56\u5305\u95ed\u73af\u3002\u4f18\u52bf\uff1a  <\/p>\n<ul>\n<li>\u4f9d\u8d56\u83b7\u53d6\u65e0\u9700\u4e8c\u6b21\u8df3\u8f6c\uff08\u76f4\u63a5\u4ece\u6e90\u4e0b\u8f7d\u4e8c\u8fdb\u5236\uff09\uff0c\u7a33\u5b9a\u6027\u66f4\u9ad8\uff08\u907f\u514d\u4f9d\u8d56\u7684\u5916\u90e8 Git \u4ed3\u5e93\u5931\u6548\uff09\uff1b  <\/li>\n<li>\u652f\u6301\u4f9d\u8d56\u4f20\u9012\u6027\u81ea\u52a8\u89e3\u6790\uff08\u901a\u8fc7 <code>pom.xml<\/code> \u4e2d\u7684 <code>dependencies<\/code> \u6807\u7b7e\uff09\uff0c\u65e0\u9700\u624b\u52a8\u7ba1\u7406\u95f4\u63a5\u4f9d\u8d56\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6210\u719f\u7684\u4ed3\u5e93\u7ba1\u7406\u751f\u6001<\/strong><br \/>\n\u914d\u5957\u5de5\u5177\u94fe\u5b8c\u5584\uff0c\u6709 Nexus\u3001Artifactory \u7b49\u4e13\u4e1a\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u652f\u6301\uff1a  <\/p>\n<ul>\n<li>\u7ec6\u7c92\u5ea6\u6743\u9650\u63a7\u5236\uff08\u5982\u53ea\u8bfb\/\u8bfb\u5199\u6743\u9650\u3001\u6309\u7ec4\u5206\u914d\u6743\u9650\uff09\uff1b  <\/li>\n<li>\u7f13\u5b58\u7b56\u7565\uff08\u81ea\u52a8\u7f13\u5b58\u516c\u5171\u6e90\u4f9d\u8d56\uff0c\u52a0\u901f\u5185\u90e8\u8bbf\u95ee\uff09\uff1b  <\/li>\n<li>\u7248\u672c\u6e05\u7406\uff08\u81ea\u52a8\u5220\u9664\u8fc7\u671f\u5feb\u7167\u7248\u672c\uff09\u3001\u955c\u50cf\u540c\u6b65\u7b49\u9ad8\u7ea7\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8de8\u751f\u6001\u517c\u5bb9\u6027<\/strong><br \/>\n\u4e0d\u4ec5\u652f\u6301 Java\/Android\uff0c\u8fd8\u80fd\u901a\u8fc7\u63d2\u4ef6\u6269\u5c55\u81f3\u5176\u4ed6\u8bed\u8a00\uff08\u5982 Scala\u3001Kotlin\uff09\uff0c\u751a\u81f3\u53ef\u4f5c\u4e3a\u901a\u7528\u4e8c\u8fdb\u5236\u4ed3\u5e93\u5b58\u50a8\u975e\u4ee3\u7801\u8d44\u6e90\uff08\u5982\u914d\u7f6e\u6587\u4ef6\uff09\uff0c\u9002\u7528\u8303\u56f4\u66f4\u5e7f\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4e25\u683c\u7684\u7248\u672c\u89c4\u8303<\/strong><br \/>\n\u5f3a\u5236\u9075\u5faa\u8bed\u4e49\u5316\u7248\u672c\uff08\u5982 <code>release<\/code>\/<code>snapshot<\/code> \u7248\u672c\u533a\u5206\uff09\uff0c\u5feb\u7167\u7248\u672c\u81ea\u52a8\u66f4\u65b0\uff0c\u6b63\u5f0f\u7248\u672c\u4e0d\u53ef\u4fee\u6539\uff0c\u786e\u4fdd\u4f9d\u8d56\u7248\u672c\u7684\u552f\u4e00\u6027\u548c\u53ef\u8ffd\u6eaf\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<h3><strong>\u4e8c\u3001\u52a3\u52bf\u5bf9\u6bd4<\/strong><\/h3>\n<h4><strong>1. CocoaPods spec \u6e90\u7684\u52a3\u52bf<\/strong><\/h4>\n<ul>\n<li>\n<p><strong>\u4f9d\u8d56\u7a33\u5b9a\u6027\u4f9d\u8d56\u5916\u90e8\u8d44\u6e90<\/strong><br \/>\n\u7531\u4e8e spec \u6e90\u4e0d\u5b58\u50a8\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u7ec4\u4ef6\u5b9e\u9645\u6e90\u7801\/\u4e8c\u8fdb\u5236\u9700\u4f9d\u8d56\u5916\u90e8 Git \u4ed3\u5e93\u6216\u4e0b\u8f7d\u94fe\u63a5\uff0c\u82e5\u5916\u90e8\u8d44\u6e90\u5931\u6548\uff08\u5982\u4ed3\u5e93\u5220\u9664\u3001\u94fe\u63a5\u8fc7\u671f\uff09\uff0c\u4f1a\u5bfc\u81f4\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\u8584\u5f31<\/strong><br \/>\n\u7f3a\u4e4f\u4e13\u4e1a\u7684 spec \u6e90\u7ba1\u7406\u5de5\u5177\uff0c\u4e3b\u8981\u4f9d\u8d56 Git \u539f\u751f\u529f\u80fd\uff0c\u96be\u4ee5\u5b9e\u73b0\uff1a  <\/p>\n<ul>\n<li>\u7ec6\u7c92\u5ea6\u6743\u9650\u63a7\u5236\uff08\u5982\u9650\u5236\u67d0\u4e9b\u7528\u6237\u63d0\u4ea4\u7279\u5b9a\u7ec4\u4ef6\u7684 spec\uff09\uff1b  <\/li>\n<li>\u81ea\u52a8\u5316\u7248\u672c\u6e05\u7406\uff08\u9700\u624b\u52a8\u5220\u9664\u65e7 spec \u6216\u901a\u8fc7\u811a\u672c\u7ef4\u62a4\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f9d\u8d56\u89e3\u6790\u6548\u7387\u4f4e<\/strong><br \/>\n\u5927\u89c4\u6a21\u9879\u76ee\uff08\u4f9d\u8d56\u6570\u767e\u4e2a\u7ec4\u4ef6\uff09\u65f6\uff0cCocoaPods \u89e3\u6790\u4f9d\u8d56\u6811\u7684\u901f\u5ea6\u8f83\u6162\uff0c\u5c24\u5176\u9996\u6b21 <code>pod install<\/code> \u65f6\u9700\u62c9\u53d6\u6240\u6709 spec \u4ed3\u5e93\u7684\u5b8c\u6574\u5386\u53f2\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u7248\u672c\u7ba1\u7406\u677e\u6563<\/strong><br \/>\n\u5141\u8bb8\u4fee\u6539\u5df2\u53d1\u5e03\u7684 spec \u7248\u672c\uff08\u65e0\u5f3a\u5236\u4e0d\u53ef\u53d8\u7ea6\u675f\uff09\uff0c\u53ef\u80fd\u5bfc\u81f4\u201c\u540c\u4e00\u7248\u672c\u53f7\u5bf9\u5e94\u4e0d\u540c\u4ee3\u7801\u201d\u7684\u95ee\u9898\uff0c\u7834\u574f\u4f9d\u8d56\u4e00\u81f4\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<h4><strong>2. Maven \u6e90\u7684\u52a3\u52bf<\/strong><\/h4>\n<ul>\n<li>\n<p><strong>\u4ed3\u5e93\u4f53\u79ef\u5927\uff0c\u7ef4\u62a4\u6210\u672c\u9ad8<\/strong><br \/>\n\u5b58\u50a8\u4e8c\u8fdb\u5236\u6587\u4ef6\u5bfc\u81f4\u6e90\u4ed3\u5e93\u4f53\u79ef\u5e9e\u5927\uff08\u5c24\u5176\u5305\u542b\u5927\u91cf <code>snapshot<\/code> \u7248\u672c\u65f6\uff09\uff0c\u9700\u8981\u66f4\u591a\u5b58\u50a8\u7a7a\u95f4\u548c\u5e26\u5bbd\uff0c\u4e14\u5907\u4efd\/\u8fc1\u79fb\u6210\u672c\u9ad8\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u590d\u6742\uff0c\u5b66\u4e60\u6210\u672c\u9ad8<\/strong><br \/>\n<code>pom.xml<\/code> \u914d\u7f6e\u9879\u7e41\u591a\uff08\u5982\u4f9d\u8d56\u8303\u56f4 <code>scope<\/code>\u3001\u4f20\u9012\u6027\u63a7\u5236 <code>exclusions<\/code> \u7b49\uff09\uff0c\u5bf9\u65b0\u624b\u4e0d\u591f\u53cb\u597d\uff1b\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff08\u5982 Nexus\uff09\u7684\u521d\u59cb\u5316\u548c\u4f18\u5316\u4e5f\u9700\u8981\u4e13\u4e1a\u77e5\u8bc6\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5bf9\u7279\u5b9a\u751f\u6001\u9002\u914d\u4e0d\u8db3<\/strong><br \/>\n\u867d\u7136\u53ef\u7528\u4e8e Android \u5f00\u53d1\uff0c\u4f46\u5bf9 Xcode \u7279\u6709\u7684\u7f16\u8bd1\u914d\u7f6e\uff08\u5982 <code>.xcconfig<\/code>\u3001<code>modulemap<\/code>\uff09\u652f\u6301\u8f83\u5f31\uff0c\u65e0\u6cd5\u50cf CocoaPods \u90a3\u6837\u6df1\u5ea6\u96c6\u6210 Apple \u5f00\u53d1\u5de5\u5177\u94fe\u3002<\/p>\n<\/li>\n<\/ul>\n<h3><strong>\u4e09\u3001\u603b\u7ed3\uff1a\u9002\u7528\u573a\u666f\u51b3\u5b9a\u9009\u62e9<\/strong><\/h3>\n<table>\n<thead>\n<tr>\n<th>\u7ef4\u5ea6<\/th>\n<th>CocoaPods spec \u6e90<\/th>\n<th>Maven \u6e90<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\u6700\u4f73\u9002\u7528\u573a\u666f<\/strong><\/td>\n<td>iOS\/macOS \u7ec4\u4ef6\u7ba1\u7406\uff0c\u9700\u6df1\u5ea6\u9002\u914d Xcode<\/td>\n<td>Java\/Android \u4f9d\u8d56\u7ba1\u7406\uff0c\u9700\u4e25\u683c\u7248\u672c\u63a7\u5236<\/td>\n<\/tr>\n<tr>\n<td><strong>\u6838\u5fc3\u4f18\u52bf<\/strong><\/td>\n<td>\u8f7b\u91cf\u3001Git \u539f\u751f\u96c6\u6210\u3001Apple \u751f\u6001\u9002\u914d\u597d<\/td>\n<td>\u5b8c\u6574\u5b58\u50a8\u3001\u5de5\u5177\u94fe\u6210\u719f\u3001\u8de8\u751f\u6001\u517c\u5bb9\u3001\u6743\u9650\u4e25\u683c<\/td>\n<\/tr>\n<tr>\n<td><strong>\u4e3b\u8981\u75db\u70b9<\/strong><\/td>\n<td>\u4f9d\u8d56\u5916\u90e8\u8d44\u6e90\u3001\u7ba1\u7406\u5de5\u5177\u8584\u5f31<\/td>\n<td>\u4f53\u79ef\u5927\u3001\u914d\u7f6e\u590d\u6742\u3001\u7279\u5b9a\u751f\u6001\u9002\u914d\u4e0d\u8db3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e24\u8005\u7684\u4f18\u52a3\u52bf\u672c\u8d28\u662f\u7531\u5176\u670d\u52a1\u7684\u751f\u6001\u7279\u6027\u51b3\u5b9a\u7684\uff1aCocoaPods \u6e90\u4e3a\u7075\u6d3b\u591a\u53d8\u7684 Apple \u5f00\u53d1\u573a\u666f\u8bbe\u8ba1\uff0c\u800c Maven \u6e90\u5219\u66f4\u4fa7\u91cd\u4f01\u4e1a\u7ea7 Java \u751f\u6001\u7684\u7a33\u5b9a\u6027\u548c\u89c4\u8303\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CocoaPods spec \u6e90\uff08iOS\/macOS \u751f\u6001\uff09\u548c Maven \u6e90\uff08Java\/Android \u751f\u6001&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6869\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[159],"tags":[],"class_list":["post-6869","post","type-post","status-publish","format-standard","hentry","category-159"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6869"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6869\/revisions"}],"predecessor-version":[{"id":6870,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6869\/revisions\/6870"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}