真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

本篇內(nèi)容主要講解“build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么”吧!

目前創(chuàng)新互聯(lián)建站已為上千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、高碑店網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

build.gradle里的dependencies標(biāo)簽頁(yè):

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

如果把dependencies改成dependencies2, gradle build的輸出會(huì)遇到錯(cuò)誤消息:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

A problem occurred evaluating root project 'quickstart'.

Could not find method dependencies2() for arguments [build_a2307i03s3k13jdug3afl2lin$_run_closure3@21c69f73] on root project 'quickstart' of type org.gradle.api.Project.

找到這個(gè)org.gradle.api.Project類,位于目錄org\gradle\api下面:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

打開(kāi)Project.java, 查看關(guān)于dependencies的說(shuō)明:

A project generally has a number of dependencies it needs in order to do its work. Also, a project generally * produces a number of artifacts, which other projects can use. Those dependencies are grouped in configurations, and * can be retrieved and uploaded from repositories. You use the {@link org.gradle.api.artifacts.ConfigurationContainer} * returned by {@link #getConfigurations()} method to manage the configurations. The {@link * org.gradle.api.artifacts.dsl.DependencyHandler} returned by {@link #getDependencies()} method to manage the * dependencies. The {@link org.gradle.api.artifacts.dsl.ArtifactHandler} returned by {@link #getArtifacts()} method to * manage the artifacts. The {@link org.gradle.api.artifacts.dsl.RepositoryHandler} returned by {@link * #getRepositories()} method to manage the repositories.

Project是一個(gè)接口:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

里面定義了dependencies這個(gè)方法:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

這個(gè)方法的實(shí)現(xiàn)在哪里呢?

將dependencies標(biāo)簽頁(yè)里的implementation標(biāo)簽隨便換個(gè)名字:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

gradle build出錯(cuò):

A problem occurred evaluating root project 'quickstart'. Could not find method implementation2() for arguments [{group=commons-collections, name=commons-collections, version=3.2.2}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

說(shuō)明Implementation標(biāo)簽頁(yè)的實(shí)現(xiàn)就位于org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler類里.

group改成group2:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

build出錯(cuò):

A problem occurred evaluating root project 'quickstart'. Could not set unknown property 'group2' for DefaultExternalModuleDependency{group='null', name='commons-collections', version='3.2.2', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.

所以build.gradle文件dependencies里的標(biāo)簽對(duì)應(yīng)了DefaultExternalModuleDependency類的實(shí)例. 前者dependencies屬性group, name和version對(duì)應(yīng)了DefaultExternalModuleDependency類的成員:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

再把dependenies里的group屬性值稍作修改,改成一個(gè)并不存在的庫(kù)文件名:

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

gradle build報(bào)錯(cuò):

Could not resolve all files for configuration ':compileClasspath'. Could not find commons-collections-:commons-collections:3.2.2. Searched in the following locations: - https://aven2/commons-collections-/commons-collections/3.2.2/commons-collections-3.2.2.pomhttps://aven2/commons-collections-/commons-collections/3.2.2/commons-collections-3.2.2.pomhttps://aven2/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.pom

build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么

到此,相信大家對(duì)“build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!


網(wǎng)站名稱:build.gradle里dependencies標(biāo)簽頁(yè)的實(shí)現(xiàn)原理是什么
本文網(wǎng)址:http://weahome.cn/article/ggsgsj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部