When using the Nexus Maven build their own warehouses, we need to do for some public Maven repository mirroring, which requires a real address these warehouses, here is the address of the warehouse:
warehouse name | Warehouse Address | gradle reference |
---|---|---|
JCenter | https://jcenter.bintray.com | JCenter () |
mavenCentral | https://repo1.maven.org/maven2 or http://central.maven.org/maven2/ (slower) | mavenCentral() |
https://dl.google.com/dl/android/maven2/ | google() | |
Ali Cloud | http://maven.aliyun.com/nexus/content/repositories/jcenter/ or http://maven.aliyun.com/nexus/content/groups/public/ | maven {url 'Ali address'} |
Notes:
1. mavenCentral official website address http://mvnrepository.com/ where you can search for the library and view popular library by name.
2. google maven repository is not supported by the browser, and if you need to download a specific library, you can splice themselves such addresses https://dl.google.com/dl/android/maven2/com/android/databinding/compiler/ 3.0.1 / compiler-3.0.1-sources.jar to download other maven repository empathy.
3. When we downloaded a third party library by gradle, can gradle cache directory to find them,
windows: C:\Users\用户名\.gradle\caches\modules-2\files-2.1
OSX: /Users/用户名/.gradle/caches/modules-2/files-2.1
If you use Android Studio comes with gradle so, \ \ \ gradle- version \ next xxx android-studio gradle \ caches modules -2 \ files-2.1 also has a large library.
4. Due to the domestic network environment, we can choose the best Maven repository by the following method:
repositories {
// maven库
def aliMaven = "http://maven.aliyun.com/nexus/content/groups/public/"
def cMaven = "https://repo1.maven.org/maven2"
// 先从url中下载jar若没有找到,则在artifactUrls中寻找
maven {
url aliMaven
artifactUrls cMaven
}
}