在Gradle项目中,我们可以定义多个远程/本地Maven仓库。
buildscript {
repositories {
mavenLocal()
mavenCentral()
jCenter()
maven {
url 'https://example1.mavenrepo.com/public'
}
maven {
url "https://example2.mavenrepo.com/release"
}
}
dependencies {
classpath 'com.example.mydependencies:mylibrary:1.0.0'
}
}
如果 mylibrary
存在于所有 Maven 仓库中。 Gradle 会选择哪一个?我可以将 Gradle 配置为仅下载某些 Maven 存储库中的 mylibrary
吗?
最佳答案
您可以在 the doc 中找到
A project can have multiple repositories. Gradle will look for a dependency in each repository in the order they are specified, stopping at the first repository that contains the requested module.
关于android - 给定多个 Maven 存储库,Gradle 将选择哪个依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46168381/