天天看點

在eclipse的maven插件中搜尋本地倉庫中的jar搜尋不到的解決方案

在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包了。

  如下圖:

繼續閱讀