maven 中央倉庫 無法訪問
阿新 • • 發佈:2019-01-07
mvn構建工程時,編譯提示如下錯誤 :
1、 Connect to repo.maven.apache.org:443.
2、 Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar.
3、 Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar.
其原因是無法訪問maven.org網站。
解決此問題有三個辦法可選,一個是在maven的配置檔案中設定代理,二個是直接使用翻牆軟體,另一個是在maven的配置檔案中設定聯通網路下,能夠訪問的中央倉庫的mirrors。在網上搜索了下阿里雲提供的映象可用,還有其他的一一些映象也一併給出來了,配置方式如下:
1、開啟maven配置檔案(maven安裝目錄下的conf目錄下的settings.xml檔案)
2、搜尋mirrors關鍵字,加入mirror映象節點
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id> central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<!-- 中央倉庫在中國的映象 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>