Created
September 1, 2023 07:16
-
-
Save yangl/8dc81b385c8182efdc577bf9d45e4058 to your computer and use it in GitHub Desktop.
init.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
repositories { | |
maven { | |
allowInsecureProtocol = true | |
url = 'https://maven.aliyun.com/repository/public' | |
} | |
def REPOSITORY_URL = 'https://maven.aliyun.com/repository/public/' | |
//做一些国外不稳定的地址连接的替换 | |
all { | |
ArtifactRepository repo -> | |
if (repo instanceof MavenArtifactRepository) { | |
def url = repo.url.toString() | |
if (url.startsWith('https://artifacts.elastic.co/maven') | |
|| url.startsWith('https://repo1.maven.org/maven2') | |
|| url.startsWith('https://repo.maven.org/maven2') | |
|| url.startsWith('https://jcenter.bintray.com/') | |
|| url.startsWith('https://repo.maven.apache.org/maven2') | |
) { | |
project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL." | |
remove repo | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment