在eclipse的maven外掛中搜尋本地倉庫中的jar搜尋不到的解決方案
阿新 • • 發佈:2019-01-08
在eclipse的maven外掛中搜索本地倉庫中的jar搜尋不到的解決方案
之前,用過maven管理專案的童鞋都知道本地會有一個${User_Home}.m2/repository倉庫 是用來存放jar包的地方。但是,在eclipse中的maven倉庫中 搜尋不到本地倉庫中的jar包。
原因是因為maven中的本地倉庫的index索引沒有更新,導致在eclipse的maven外掛中搜索不到。
解決方案:
在eclipse中開啟選單 window-> show view –> other –> Maven -> maven repositories
開啟之後,選擇local repositories –> local repository ,右擊,選擇Build index.
更新完索引之後,在通過右鍵單擊pom.xml檔案選擇maven –> add dependency 或者是開啟pom.xml檔案,選擇dependencies –>add 時,就可以搜尋到本地倉庫的jar包了。
如下圖:
如果想搜尋公服上的jar
就選擇Global Repositories ->右擊 update index. (此處更新比較慢,需要耐心等候)。