解決IDEA無法下載maven依賴的問題
今天新建一個(gè)springboot項(xiàng)目時(shí),項(xiàng)目建好后,在IDEA下載依賴包時(shí),下載了很久都沒有下載完,后來仔細(xì)一看,是下載不了。

解決方法:
在項(xiàng)目的pom.xml文件上右鍵,彈出框中選擇maven,再選擇open 'settings.xml' 或者是 create 'settings.xml' ,操作如圖:

在該文件中填入如下內(nèi)容:
<?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>nexus</id>
<name>internal nexus repository</name>
<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
重新右鍵pom.xml文件,選擇 maven ,選擇 Reimport 即可下載依賴。操作步驟及settings.xml文件內(nèi)容如圖:

settings.xml文件內(nèi)容:

至此,依賴依法下載的問題已經(jīng)解決。。
疑惑:將settings.xml文件中的<mirrors>替換成如下內(nèi)容,竟然也無法下載依賴(但看網(wǎng)上博客說會(huì)讓下載速度變快的)
<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> <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://192.168.1.100:8081/nexus/content/groups/public/</url>--> <url>http://repo.maven.apache.org/maven2</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
- 關(guān)于maven使用過程中無法導(dǎo)入依賴的一些總結(jié)
- idea創(chuàng)建maven父子工程導(dǎo)致子工程無法導(dǎo)入父工程依賴
- IDEA 2020.1 版自動(dòng)導(dǎo)入MAVEN依賴的方法(新版MAVEN無法自動(dòng)導(dǎo)入/更新POM依賴、MAVEN設(shè)置自動(dòng)更新、自動(dòng)更新快捷鍵)
- IDEA中創(chuàng)建maven項(xiàng)目引入相關(guān)依賴無法下載jar問題及解決方案
- idea2020.1無法自動(dòng)加載maven依賴的jar包問題及解決方法
- IDEA最新版2020.1的maven工程本地依賴倉庫無法使用問題(已解決)
- maven無法依賴spring-cloud-stater-zipkin的解決方案
相關(guān)文章
springboot調(diào)用python文件的詳細(xì)方案
這篇文章主要為大家詳細(xì)介紹了springboot調(diào)用python文件的詳細(xì)方案,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2025-04-04
SpringBoot整合WebService服務(wù)的實(shí)現(xiàn)代碼
WebService是一個(gè)SOA(面向服務(wù)的編程)的架構(gòu),它是不依賴于語言,不依賴于平臺(tái),可以實(shí)現(xiàn)不同的語言間的相互調(diào)用,通過Internet進(jìn)行基于Http協(xié)議的網(wǎng)絡(luò)應(yīng)用間的交互,這篇文章主要介紹了SpringBoot整合WebService服務(wù)的實(shí)例代碼,需要的朋友可以參考下2022-02-02
Spring中的@ControllerAdvice和@ExceptionHandler注解處理全局異常
這篇文章主要介紹了Spring中的@ControllerAdvice和@ExceptionHandler注解處理全局異常,@ControllerAdvice ,@ControllerAdvice是一個(gè)非常有用的注解,顧名思義,這是一個(gè)增強(qiáng)的 Controller,一般配合@ExceptionHandler使用來處理全局異常,需要的朋友可以參考下2024-01-01
Springboot Retry組件@Recover失效問題解決方法
在使用springboot的retry模塊時(shí),你是否出現(xiàn)過@Recover注解失效的問題呢?不用擔(dān)心,這篇文章就來告訴你解決@Recover失效的辦法,需要的小伙伴可以參考一下2021-11-11

