91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

build.gradle里dependencies標簽頁的實現原理是什么

發布時間:2021-11-01 10:25:23 來源:億速云 閱讀:349 作者:iii 欄目:編程語言

本篇內容主要講解“build.gradle里dependencies標簽頁的實現原理是什么”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“build.gradle里dependencies標簽頁的實現原理是什么”吧!

build.gradle里的dependencies標簽頁:

build.gradle里dependencies標簽頁的實現原理是什么

如果把dependencies改成dependencies2, gradle build的輸出會遇到錯誤消息:

build.gradle里dependencies標簽頁的實現原理是什么

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.

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

build.gradle里dependencies標簽頁的實現原理是什么

打開Project.java, 查看關于dependencies的說明:

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是一個接口:

build.gradle里dependencies標簽頁的實現原理是什么

里面定義了dependencies這個方法:

build.gradle里dependencies標簽頁的實現原理是什么

這個方法的實現在哪里呢?

將dependencies標簽頁里的implementation標簽隨便換個名字:

build.gradle里dependencies標簽頁的實現原理是什么

gradle build出錯:

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.

說明Implementation標簽頁的實現就位于org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler類里.

group改成group2:

build.gradle里dependencies標簽頁的實現原理是什么

build出錯:

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里的標簽對應了DefaultExternalModuleDependency類的實例. 前者dependencies屬性group, name和version對應了DefaultExternalModuleDependency類的成員:

build.gradle里dependencies標簽頁的實現原理是什么

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

build.gradle里dependencies標簽頁的實現原理是什么

gradle build報錯:

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標簽頁的實現原理是什么


到此,相信大家對“build.gradle里dependencies標簽頁的實現原理是什么”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

临朐县| 兴国县| 平邑县| 山西省| 怀集县| 四会市| 三门县| 中山市| 广安市| 遂川县| 平顺县| 宝坻区| 浮山县| 行唐县| 宜城市| 安远县| 延长县| 长沙县| 武强县| 晋江市| 休宁县| 巴东县| 塔城市| 清苑县| 永丰县| 大竹县| 西充县| 镇巴县| 白玉县| 措勤县| 名山县| 滕州市| 仁化县| 大丰市| 寿宁县| 东宁县| 兴海县| 思南县| 南皮县| 都江堰市| 灵山县|