# mirrors
**Repository Path**: dawenxi484/mirrors
## Basic Information
- **Project Name**: mirrors
- **Description**: 各种镜像源加速
- **Primary Language**: Java
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-01
- **Last Updated**: 2022-08-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# mirrors
#### 介绍
各种镜像源加速
## pypi
```shell
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
其他镜像源
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) https://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/
```
## android gradle
Gradle 使用阿里云国内镜像
1、对单个项目生效,在项目中的build.gradle修改内容
```
buildscript {
repositories {
maven{ url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'https://dl.google.com/dl/android/maven2/' }
maven { url "https://www.jitpack.io" }
google()
mavenCentral()
}
}
allprojects {
repositories {
maven{ url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'https://dl.google.com/dl/android/maven2/' }
maven { url "https://www.jitpack.io" }
google()
mavenCentral()
}
}
```
2、对所有项目生效,在USER_HOME/.gradle/下创建init.gradle文件
```
allprojects {
repositories {
def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
all {
ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
}
}
}
```
## maven
修改maven根目录下的conf文件夹中的在settings.xml文件中的mirrors下添加mirror标签(idea下可以File-> maven -> 右键生成settings.xml)
```xml
alimaven
central
aliyun maven
http://maven.aliyun.com/nexus/content/repositories/central/
repo1
central
Human Readable Name for this Mirror.
http://repo1.maven.org/maven2/
repo2
central
Human Readable Name for this Mirror.
http://repo2.maven.org/maven2/
```