Skip to content

Instantly share code, notes, and snippets.

@holazt
Forked from y0ngb1n/maven-mirrors.md
Created March 30, 2020 03:58
Show Gist options
  • Save holazt/40eb61d26f40251de86bbf275936997f to your computer and use it in GitHub Desktop.
Save holazt/40eb61d26f40251de86bbf275936997f to your computer and use it in GitHub Desktop.
使用阿里云公共仓库加速 Maven
<?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