{"id":84658,"date":"2020-05-15T21:27:22","date_gmt":"2020-05-15T13:27:22","guid":{"rendered":"http:\/\/4563.org\/?p=84658"},"modified":"2020-05-15T21:27:22","modified_gmt":"2020-05-15T13:27:22","slug":"gradle-%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%ae%e4%be%9d%e8%b5%96%e5%af%b9%e6%89%80%e6%9c%89%e7%9a%84%e5%ad%90%e6%a8%a1%e5%9d%97%e9%83%bd%e7%94%9f%e6%95%88%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=84658","title":{"rendered":"gradle \u600e\u4e48\u914d\u7f6e\u4f9d\u8d56\u5bf9\u6240\u6709\u7684\u5b50\u6a21\u5757\u90fd\u751f\u6548\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  gradle \u600e\u4e48\u914d\u7f6e\u4f9d\u8d56\u5bf9\u6240\u6709\u7684\u5b50\u6a21\u5757\u90fd\u751f\u6548\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rizon <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u7814\u7a76\u4e86\u597d\u534a\u5929\u4e5f\u4e0d\u4f1a\u3002 \u6211\u5728\u6839\u6a21\u5757\u6dfb\u52a0\uff1a<\/p>\n<pre><code>subprojects{  dependencies{   testCompile group: 'junit', name: 'junit', version: '4.12'  } } <\/code><\/pre>\n<p>\u8fd9\u4e2a gradle \u6267\u884c\u4f1a\u62a5\u9519<\/p>\n<pre><code>A problem occurred evaluating root project 'operation'. &gt; Could not find method testCompile() for arguments [{group=junit, name=junit, version=4.12}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1478130\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ldcloli <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b50\u9879\u76ee\u4e2d\u6709\u4e0d\u652f\u6301 testCompile \u5b57\u6bb5\u7684\u6a21\u5757\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1478131\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : rizon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ldcloli #1 \u6211\u53ea\u80fd\u6bcf\u4e2a\u5b50\u9879\u76ee\u5206\u522b\u914d\u7f6e testCompile \u624d\u884c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1478132\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : flywith24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f7f\u7528 buildSrc\uff0c\u6dfb\u52a0\u516c\u5171\u4f9d\u8d56\u548c\u914d\u7f6e<\/p>\n<p>https:\/\/juejin.im\/post\/5e22c2ce6fb9a02ff67d41c3<\/p>\n<p>\u8fd9\u4e2a demo \u662f kotlin \u7684\uff0c\u4e5f\u53ef\u4ee5\u7528 groovy \u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1478133\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zoharSoul <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b50\u6a21\u5757\u80af\u5b9a\u6709\u4f9d\u8d56\u5173\u7cfb\u5427.<br \/>\u653e\u5728 base \u90a3\u4e2a\u5b50\u6a21\u5757\u91cc\u5c31\u53ef\u4ee5\u4e86\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1478134\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : norcm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             compile \u548c testCompile \u662f\u5c5e\u4e8e java \u6216\u8005 java-library \u8fd9\u4e2a\u63d2\u4ef6\u7684,\u6240\u4ee5\u4f60\u5f97\u7533\u660e\u4f7f\u7528 java \u63d2\u4ef6:<br \/>subprojects{<br \/> apply plugin: &#8220;java-library&#8221;<br \/> dependencies{<br \/> testCompile group: &#8216;junit&#8217;, name: &#8216;junit&#8217;, version: &#8216;4.12&#8217;<br \/> }<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>gradle \u600e\u4e48\u914d\u7f6e\u4f9d\u8d56\u5bf9\u6240\u6709\u7684&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\/84658"}],"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=84658"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/84658\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84658"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}