使用Maven添加依賴項(xiàng)時(shí)(Add Dependency)時(shí),沒有提示項(xiàng)目可用,并且在Console中,輸出:?
Unable to update index for central|http://repo1.maven.org/maven2 。?
解決方式如下:?
1、通過其它方式下載如下兩個(gè)文件:?
http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.properties?
http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz?
2、找一個(gè)Apache Tomcat服務(wù)器,在其根據(jù)目錄下建立一個(gè) /maven2/.index 的虛擬目錄(注意: 如果你使用的是XP系統(tǒng), 可能無法建立.index文件夾, 必須使用虛擬目錄),把上述兩個(gè)文件拷貝至該虛擬目錄指向的目錄下。?
3、編輯 c:\WINDOWS\system32\drivers\etc\hosts 文件,在文件中加入:?
127.0.0.1??? repo1.maven.org?
注:127.0.0.1 為步驟2的Apache Tomcat服務(wù)器IP地址。?
4、在Eclipse中,打開 Maven Repositories 面板,?
在 Global Repositories --> central 項(xiàng)上,點(diǎn)右鍵,Rebuild Index 即可。?
5、移除之前在 hosts 文件中添加的內(nèi)容。?
6、(可選)把Properties中Maven項(xiàng)的 Download repository index updates on starup 選項(xiàng)去除。
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
