在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. (此處更新比較慢,需要耐心等候)
原文地址:http://www.educity.cn/wenda/469741.html