I’m looking for a way to specify repositories to be used per-dependency, or per “flavor” to be precise, but per dependency works as well. Essentially, I want dependencies that go into the runtime classpath (and recursively, their dependencies as well) to be retrieved from one of the repositories, but other dependencies (like those included exclusively during tests) should be downloaded from another different repository. In order to do this I’m looking for some kind of way of specifying something like:
dependencies.forEach {
if (compileClasspathDependencies.hasOneWithName(it.name()) {
resolveFromRepository A
} else {
resolveFromRepository B
}
}
Note that I’m not looking for fallback repositories, e.g., if a dependency that needs to be resolved from repository A isn’t found there, it shouldn’t be looked for in B.
Is there even a way to do this?