想必大家在使用Maven从仓库下载Jar的时候都感觉速度非常慢吧。前几年国内的开源中国还提供了免费的Maven镜像,但是由于运营成本过高,此Maven仓库在运营两年后被迫关闭了。不过高兴的是,阿里云在2016年08月悄悄上线了Maven仓库,点这里:http://maven.aliyun.com
。我们可以把下面的配置复制到$MAVEN_HOME/conf/setting.xml
里面:
<?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"> <localRepository>/home/iteblog/repo</localRepository> <servers> <server> <id>releases</id> <username>ali</username> <password>ali</password> </server> </servers> <profiles> <profile> <id>ali</id> <repositories> <repository> <id>central</id> <url>https://maven.aliyun.com/repository/central/</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>ali</id> <url>https://maven.aliyun.com/repository/central/</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>ali</activeProfile> </activeProfiles> </settings>
然后使用Maven编译你的代码,这时候Maven会从阿里云上面下载Jar依赖,速度明显要比默认的快多了!
其他Maven仓库
我们还可以设置以下的Maven仓库地址,如下:
<mirrors> <mirror> <id>wso2maven</id> <name>wso2 maven</name> <url>http://maven.wso2.org/nexus/content/groups/public/</url> <mirrorof>central</mirrorof> </mirror> </mirrors>
替换上最上面阿里云Maven仓库地址即可。以下的地址也可以使用:
http://maven.wso2.org/nexus/content/groups/public/ http://jcenter.bintray.com/ http://maven.antelink.com/content/repositories/central/ http://maven.springframework.org/release/ http://maven.antelink.com/content/repositories/central/ http://mavensync.zkoss.org/maven2/ http://repository.jboss.com/maven2/ http://maven.aliyun.com/nexus/content/groups/public http://uk.maven.org/maven2/ http://repo1.maven.org/maven2/ http://maven.springframework.org/milestone http://maven.jeecg.org/nexus/content/repositories/ https://repository.apache.org/content/groups/public/ https://repository.jboss.org/nexus/content/repositories/releases/ http://repo.maven.apache.org/maven2 https://oss.sonatype.org/content/repositories http://repo.spring.io/release/ http://repo.spring.io/snapshot/本博客文章除特别声明,全部都是原创!
原创文章版权归过往记忆大数据(过往记忆)所有,未经许可不得转载。
本文链接: 【推荐几个国内访问比较快的Maven仓库镜像】(https://www.iteblog.com/archives/2022.html)
感谢分享~~~