[英]Which dependency will Gradle choose given multiple maven repository?
In Gradle project, we can define multiple remote / local Maven repository.在 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'
}
}
If mylibrary
exist in all of Maven repo.如果mylibrary
存在于所有 Maven 存储库中。 Which one will Gradle choose? Gradle会选择哪一款? Can I configure Gradle to only download mylibrary
in certain Maven repo?我可以将 Gradle 配置为仅在某些 Maven 存储库中下载mylibrary
吗?
I don't think there is a way to point to the gradlew to use particular repository or order it.我认为没有办法指向 gradlew 使用特定的存储库或订购它。 Gradlew by design uses a single repository for all dependencies. Gradlew 通过设计为所有依赖项使用单个存储库。 If any of them fail, the build fails.如果其中任何一个失败,则构建失败。 [Refer]: https://github.com/gradle/gradle/issues/7965 【参考】: https://github.com/gradle/gradle/issues/7965
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.