解決IDEA中Maven下載依賴包過慢或報(bào)錯(cuò)的問題
在初步建立好項(xiàng)目后,Maven在下載依賴,等了很久,始終有4個(gè)依賴報(bào)錯(cuò),通過網(wǎng)上查詢,找到了解決方案:
問題原因:導(dǎo)致IDEA Maven下載依賴包速度過慢,有很大一部分原因是因?yàn)樾枰?qǐng)求到國(guó)外鏡像倉(cāng)庫,響應(yīng)比較慢,遂會(huì)造成等待時(shí)間久、相應(yīng)報(bào)錯(cuò)的問題。
解決方案:
1.鼠標(biāo)右擊自己的項(xiàng)目,找到【Maven】
2.選擇【Open ‘settings.xml'】或者【Create ‘settings.xml’】
3.將以下代碼粘入文件中,重啟IDEA后即可提高速度
【設(shè)置Maven鏡像庫為阿里云鏡像庫和Junit鏡像庫】
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <!-- <mirror>--> <!-- <id>mirrorId</id>--> <!-- <mirrorOf>repositoryId</mirrorOf>--> <!-- <name>Human Readable Name for this Mirror.</name>--> <!-- <url>http://my.repository.com/repo/path</url>--> <!-- </mirror>--> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>uk</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://uk.maven.org/maven2/</url> </mirror> <mirror> <id>CN</id> <name>OSChina Central</name> <url>http://maven.oschina.net/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>nexus</id> <name>internal nexus repository</name> <url>http://repo.maven.apache.org/maven2</url> <mirrorOf>central</mirrorOf> </mirror> <!-- junit鏡像地址 --> <mirror> <id>junit</id> <name>junit Address/</name> <url>http://jcenter.bintray.com/</url> <mirrorOf>central</mirrorOf> </mirror> <!-- <mirrors>--> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <!--This sends everything else to /public --> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> <mirror> <id>osc</id> <mirrorOf>*</mirrorOf> <url>http://maven.oschina.net/content/groups/public/</url> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> <mirror> <id>net-cn</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://maven.net.cn/content/groups/public/</url> </mirror> <mirror> <id>ui</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://uk.maven.org/maven2/</url> </mirror> <mirror> <id>ibiblio</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> </mirror> <mirror> <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> <mirror> <id>JBossJBPM</id> <mirrorOf>central</mirrorOf> <name>JBossJBPM Repository</name> <url>https://repository.jboss.org/nexus/content/repositories/releases/</url> </mirror> </mirrors> </settings>
截止到此,Maven的依賴包就能很快速的下載了。
另一種解決方案
1.設(shè)置Maven鏡像倉(cāng)庫
在Maven文件夾下找到【conf】文件夾下,找到【setting,xml】,編輯此文件,如果里面已經(jīng)配置了阿里云鏡像庫和Junit鏡像庫則跳過,如果沒有則進(jìn)行插入。
2.編輯【setting】
以上就是解決IDEA中Maven下載依賴包過慢或報(bào)錯(cuò)的問題的詳細(xì)內(nèi)容,更多關(guān)于IDEA Maven下載過慢或報(bào)錯(cuò)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
SpringBoot v2.2以上重復(fù)讀取Request Body內(nèi)容的解決方案
這篇文章主要介紹了SpringBoot v2.2以上重復(fù)讀取Request Body內(nèi)容的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-10-10詳解SpringBoot定制@ResponseBody注解返回的Json格式
這篇文章主要介紹了詳解SpringBoot定制@ResponseBody注解返回的Json格式,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-11-11java ArrayList.remove()的三種錯(cuò)誤用法以及六種正確用法詳解
這篇文章主要介紹了java ArrayList.remove()的三種錯(cuò)誤用法以及六種正確用法詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01springboot中的springSession的存儲(chǔ)和獲取實(shí)現(xiàn)
這篇文章主要介紹了springboot中的springSession的存儲(chǔ)和獲取實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09Linux下Java Python啟動(dòng)管理腳本方便程序管理
這篇文章主要為大家介紹了Linux下Java/Python啟動(dòng)管理腳本方便程序管理,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-11-11安裝elasticsearch-analysis-ik中文分詞器的步驟講解
今天小編就為大家分享一篇關(guān)于安裝elasticsearch-analysis-ik中文分詞器的步驟講解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-02-02Java設(shè)計(jì)模式單例模式(Singleton)用法解析
這篇文章主要介紹了Java設(shè)計(jì)模式單例模式(Singleton)用法解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11