近期將自己本地的 maven 倉庫進行了遷移,idea 的版本也升級到了IntelliJ IDEA 2019.3.3 x64,但是遇到了 Plugins 報紅的情況,嘗試很多方法,終於解決,現在做一下匯總。
1、首先檢查idea的 settings -> Build, Execution, Deployment -> Maven 和自己的本機路徑是否屬實
2、檢查 Maven\apache-maven-3.6.3\conf\settings.xml 文件是否有冗余的字段 多l了的 <> 、</>要刪除
3、一個要值得注意的問題是,阿里的鏡像更新了要用https了而不是http!
1 <mirror> 2 <id>aliyunmaven</id> 3 <mirrorOf>*</mirrorOf> 4 <name>阿里雲公共倉庫</name> 5 <url>https://maven.aliyun.com/repository/public</url> 6 </mirror>
4、然后在IDEA中設置,忽略HTTPS的SSL證書驗證就好了,注意是在Maven-Importing-VM options for importer里添加
1 -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
5、我的 Maven\apache-maven-3.6.3\conf\settings.xml 如下,每次修改都要及時保存,僅供參考,
1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 6 7 <localRepository>D:\Maven\LocalWarehouse</localRepository> 8 9 <mirrors> 10 <mirror> 11 <id>aliyunmaven</id> 12 <mirrorOf>*</mirrorOf> 13 <name>阿里雲公共倉庫</name> 14 <url>https://maven.aliyun.com/repository/public</url> 15 </mirror> 16 </mirrors> 17 18 <profiles> 19 <profile> 20 <id>jdk-1.8</id> 21 <activation> 22 <activeByDefault>true</activeByDefault> 23 <jdk>1.8</jdk> 24 </activation> 25 <properties> 26 <maven.compiler.source>1.8</maven.compiler.source> 27 <maven.compiler.target>1.8</maven.compiler.target> 28 <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 29 </properties> 30 </profile> 31 </profiles> 32 33 </settings>
6、最后要將未下載成功的 jar 包刪除掉,就是那些后綴名是 .update 的文件,然后清除緩存,重啟 idea
7、maven 恢復正常
8、有什么問題大家可以在下面的評論 拋出,一起討論解決。
參考鏈接:
maven在使用阿里雲鏡像的時候下載失敗? - 知乎
https://www.zhihu.com/question/350864269