前提說明
maven版本:3.2.2 eclipse已經(jīng)正確引入自己安裝的maven,且設(shè)置好倉庫位置 出現(xiàn)錯誤引入maven工程時,pom.xml出現(xiàn)錯誤如: 
出錯原因一般都是導(dǎo)入別人的工程,因為自己的maven環(huán)境、倉庫配置信息、下載的jar包來源、甚至?xí)rIDE環(huán)境不一致導(dǎo)致 解決思路
1.檢查maven本地倉庫中是否存在改包 (1)若存在:刪掉_maven.repositories和_remote.repositories文件(或用文本編輯器打開,將“>main=”改為“>=”,即刪除main,當(dāng)然main也可能是其他值),刪除xxxx.lastUpdate相關(guān)文件,然后update project 或 update dependency (2)不存在看第2條
2.settings.xml文件是否配置了mirror,即maven下載jar的倉庫;是否聯(lián)網(wǎng);若都沒問題看第3條 3.去settings.xml文件配置的mirror倉庫地址查看對應(yīng)的jar是否存在這個倉庫。若找不到,那就換mirror吧,推薦國內(nèi)網(wǎng)速較快的鏡像地址: <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf>
放到<mirrors>標簽中即可 或者其它mirror地址如:開源中國的等等 4.直接去maven中央倉庫手動對應(yīng)版本的jar,放到本地倉庫對應(yīng)位置,刪除文件夾內(nèi)不相關(guān)文件,重新項目右鍵-->maven -->update 依賴或者update project 注: 所有關(guān)于maven配置或jar或依賴的變更最好都重新:項目右鍵-->maven -->update dependency或者update project自己解決方式
找到了我的倉庫對應(yīng)的jar位置,發(fā)現(xiàn)存在改jar,刪除對應(yīng)的jar: 
eclipse中對項目:右鍵-->maven--->update project 
問題解決! 附加
_maven.repositories簡介: _maven.repositories hold the information about the origin of the artefacts. Maven tries to update your jar from the old location (as saved in _maven.repositories) and fails. The presumtion here is that the same aftifact on a different remote repository might be different. 以上為個人嘗試過的解決方案,若有其它解決方案,或者出錯說明,歡迎留言,不勝感激!
|