Jeffrey Blattman
Jeffrey Blattman

Reputation: 22647

gradle transitive dependencies across different repos

we are having some confusion here about about dependencies are resolved. we have thing like this,

repositories {
    maven { url "http://my.repo" }
    mavenCentral()
}

my.repo has a mish-mash of our locally built artifacts and copies of some standard artifacts.

my question is what happens if part of a dependency tree is found in my.repo. will it resolve part from my.repo, and part from central? for example, suppose we had this dependency tree,

depA
  depA1
depB
  depB1

now suppose these artifacts were located here,

my.repo: depA, depB1
central: depA2, depB

will gradle resolve depA1 from central even though the parent dependency is located in my.repo? will it resolve depB1 from my.repo even though it's parent dependency is located in central?

Upvotes: 0

Views: 330

Answers (1)

Justin Ryan
Justin Ryan

Reputation: 2503

Gradle will not differentiate between repositories, though it will search the repositories in the order they are declared. I.e. all repositories for a configuration are used for resolving, the origin of the dependency won't affect which repositories transitive dependencies come from. In your example depA2 will be searched in "my.repo" first, then searched in "central".

Likewise, Gradle can not currently isolate a configuration to a set of repositories. Meaning that all configurations come from all repositories.

Upvotes: 3

Related Questions