1.Failed to read artifact descriptor for
在IDEA中創建Maven專案,在pom.xml中引入依賴時,有時候會報錯Failed to read artifact descriptor for xxx,
這可能是配置的鏡像有問題,解決程序如下:
(1)新增組態檔設定鏡像源
在C:\Users\Administrator\.m2目錄(聯想是C:\Users\LENOVO\.m2)下的settings.xml組態檔中添加以下內容:
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
如果之前不存在這個檔案,則需要先創建檔案,然后配置如下:
<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 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
這里設定了阿里的鏡像源,
(2)IDEA進行操作
-
IDEA打開專案后,右側Maven選項,點開后,再打開Lifecycle,如下:

可以看到clean、validate、compile等選項, -
右鍵clean,選中
Run 'project[clean]'(project是專案的實際名字),如下:

-
右鍵install,選中
Run 'project[install]',如下:

這個程序比較久,如果有遇到哪個jar包不能下載的情況,可以手動下載后再將其放到本地的C:\Users\LENOVO\.m2\repository目錄下, -
多載所有Maven專案
因為重新配置了Maven源,所以Maven需要重新加載依賴,如下:

-
重啟
因為多載專案后,設定的依賴等可能不會馬上生效,此時可能需要重啟IDEA,如下:


等待重啟,然后查看,如果還是不能匯入依賴,可以選擇重啟電腦再試,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/297128.html
標籤:java
