Gradle: specify the appropriate repo for the dependency

I have several repositories and many dependencies. This is similar to build.gradle:

repositories { maven {url "A"} maven {url "B"} } dependencies { compile 'libA' compile 'libB' compile 'libC' } 

Is there a way to indicate that I will download libA from one repo (A) and libB and libC from another repo (B)?

+4
source share
2 answers

Cannot associate dependency with repository. Vaults will always be searched in the declared order.

+11
source

As of January 2019, this is possible. Let's say you have a specific repo for oracles:

  maven { url 'https://artifactory.mycompany.com/somepath/oracle-binaries/' content { includeGroupByRegex "com\\.oracle.*" } } 

Note: this requires at least Gradle 5.1.

See https://docs.gradle.org/5.1.1/release-notes.html#repository-to-dependency-matching.

0
source

Source: https://habr.com/ru/post/1490939/


All Articles