網(wǎng)站首頁 編程語言 正文
前言
鏡像配置都是常規(guī)操作,必要時(shí)也可以上代理.
自己搭的nexus本質(zhì)也是一種鏡像,可以代理maven中央倉(cāng)庫(kù).
各個(gè)倉(cāng)庫(kù)的測(cè)速,可以使用這個(gè)腳本:
通過測(cè)速,調(diào)整倉(cāng)庫(kù)的順序
apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/master/deps/depsLastestChecker.gradle'
情況1 :
每次點(diǎn)擊sync project with gradle files 都去拉取某個(gè)pom,且那個(gè)pom對(duì)應(yīng)的版本真的不存在
耗時(shí):18s
1.去對(duì)應(yīng)gradle緩存里去看這個(gè)庫(kù)在不在: 確實(shí)不在
2 .看com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46-androidx這個(gè)到底在哪個(gè)倉(cāng)庫(kù)中. 直接先去maven中央倉(cāng)庫(kù)搜索:
發(fā)現(xiàn)根本就沒有這個(gè)版本的庫(kù).
mvnrepository.com/artifact/co…
解決方案:
方案1: 打印依賴樹,看這個(gè)版本誰引入的,exclude掉
方案2: 直接強(qiáng)制指定這個(gè)庫(kù)的版本為項(xiàng)目中實(shí)際用的版本,就不會(huì)去額外請(qǐng)求這個(gè)版本的pom. 如下:
all {
? ? ? ?resolutionStrategy {
? ? ? ? ? ?//gradle 刷新加速. 避免每次去刷新com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46-androidx
? ? ? ? ? ?//2.9.46-androidx不存在,所以每次都會(huì)去拉取 ;
? ? ? ? ? ?force 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.49-androidx'
情況2:
每次點(diǎn)擊sync project with gradle files或者build,都去拉一堆的pom,且這些pom對(duì)應(yīng)的版本在gradle cache里能找到
每次點(diǎn)擊sync project with gradle files,都要耗時(shí)3-5min,下載一堆已經(jīng)存在的庫(kù)(gradle cache里已經(jīng)有對(duì)應(yīng)的版本)
這時(shí)早就配置好了下面的
all{
resolutionStrategy{
// cache dynamic versions for 10 minutes
cacheDynamicVersionsFor 24, 'hours'
// don't cache changing modules at all
cacheChangingModulesFor 24, 'hours'
}
}
發(fā)現(xiàn)沒有repository里沒有配置mavenlocal, 配置一下就好了
類似這里提到的:
原文鏈接:https://juejin.cn/post/7091265454181711880
相關(guān)推薦
- 2022-07-30 golang?redis中Pipeline通道的使用詳解_Golang
- 2022-08-17 C++詳解鏈棧的實(shí)現(xiàn)_C 語言
- 2022-05-20 Modscan和Modsim 兩種Modbus調(diào)試工具使用說明
- 2022-07-06 C#數(shù)據(jù)適配器DataAdapter_C#教程
- 2022-11-20 Go語言操作Excel利器之excelize類庫(kù)詳解_Golang
- 2023-04-03 GoLang?BoltDB數(shù)據(jù)庫(kù)詳解_Golang
- 2022-04-08 Python編程-封裝,繼承與多態(tài)_python
- 2022-06-19 Go語言列表List獲取元素的4種方式_Golang
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支