解決IDEA無法下載maven依賴的問題
今天新建一個springboot項目時,項目建好后,在IDEA下載依賴包時,下載了很久都沒有下載完,后來仔細一看,是下載不了。
解決方法:
在項目的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)上博客說會讓下載速度變快的)
<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>
相關文章
SpringBoot 指標監(jiān)控actuator的專題
未來每一個微服務在云上部署以后,我們都需要對其進行監(jiān)控、追蹤、審計、控制等。SpringBoot就抽取了Actuator場景,使得我們每個微服務快速引用即可獲得生產(chǎn)級別的應用監(jiān)控、審計等功能,通讀本篇對大家的學習或工作具有一定的價值,需要的朋友可以參考下2021-11-11SpringMvc/SpringBoot HTTP通信加解密的實現(xiàn)
這篇文章主要介紹了SpringMvc/SpringBoot HTTP通信加解密的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-08-08jfinal中stateless模式嵌入shiro驗證的實現(xiàn)方式
這篇文章主要介紹了jfinal中stateless模式嵌入shiro驗證,今天,我們就來嘗試一種通過攔截器來實現(xiàn)的Stateless Jfinal嵌入方式,需要的朋友可以參考下2022-06-06SpringBoot整合Web開發(fā)之Json數(shù)據(jù)返回的實現(xiàn)
這篇文章主要介紹了SpringBoot整合Web開發(fā)其中Json數(shù)據(jù)返回的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-08-08SpringBoot配置application.yml時遇到的錯誤及解決
這篇文章主要介紹了SpringBoot配置application.yml時遇到的錯誤及解決,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-07-07