Skip to content

Instantly share code, notes, and snippets.

@y0ngb1n
Last active June 13, 2024 05:54
Show Gist options
  • Save y0ngb1n/324aa1b02ed19d61a521b2d421086bfe to your computer and use it in GitHub Desktop.
Save y0ngb1n/324aa1b02ed19d61a521b2d421086bfe to your computer and use it in GitHub Desktop.
使用公共仓库加速 Maven 构建,提升效率!

国内可用的 Maven 的仓库镜像地址

镜像源 Maven 镜像地址 帮助
阿里云 https://maven.aliyun.com/repository/public 使用文档、提供其他软件源加速
腾讯云 http://mirrors.cloud.tencent.com/nexus/repository/maven-public/ 使用文档、提供其他软件源加速
网易云 http://mirrors.163.com/maven/repository/maven-public/ 使用文档、提供其他软件源加速
华为云 https://repo.huaweicloud.com/repository/maven/ 使用文档、提供其他软件源加速

注:部分镜像源使用多线程下载可能会触发 502 ,重试即可。

<?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">
<!--
仓库的优先级:本地仓库 > settings 中的 profile > pom 中的 repository > mirror
-->
<localRepository>${user.home}/.m2/repository</localRepository>
<mirrors>
<mirror>
<id>aliyun-maven</id>
<name>阿里云公共仓库</name>
<!-- 只镜像中央仓库 -->
<mirrorOf>central</mirrorOf>
<url>https://maven.aliyun.com/repository/central</url>
<!-- 镜像所有仓库 -->
<!--<mirrorOf>*</mirrorOf>-->
<!--<url>https://maven.aliyun.com/repository/public</url>-->
</mirror>
</mirrors>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>aliyun-spring</id>
<url>https://maven.aliyun.com/repository/spring</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<activation>
<!-- 默认激活当前配置 -->
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
<activeProfiles>
<!-- 指定激活配置 -->
<activeProfile>dev</activeProfile>
</activeProfiles>
</settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment