一、修改maven根目錄下的conf文件夾中的setting.xml文件,內容以下:apache
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
以後就能享受如飛的maven下載速度。服務器
二、maven國內鏡像(maven下載慢的解決方法) maven
Maven是當前流行的項目管理工具,但官方的庫在國外常常連不上,連上也下載速度很慢。國內oschina的maven服務器很早以前就關了。今天發現阿里雲的一箇中央倉庫,親測可用。ide
<mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror>
以下:工具
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <!-- 阿里雲倉庫 --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> <!-- 中央倉庫1 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </mirror> <!-- 中央倉庫2 --> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors> </settings>
針對如上在pom.xml中配置必定不要加上做用於爲provided this
最後附帶上maven settings.xml中添加阿里雲的maven路徑,能夠提升下載速度阿里雲
<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>