One thing I miss in all build tools, and Gradle is not an exception, is the ability to specify where each dependency can be found, on which repository. That could be a huge benefit for either performance and clarity reasons. Furthermore, I don’t think that it would be hard for Gradle to implement it. Let’s take an example from my own experience. I have 3 repositories : R1,R2 and R3 and 4 dependencies D1, D2, D3, D4. D3 and D4 are some uncommon librairies which can be found only on R2 and R3 respectively. Of course R2 and R3 are both really slow. Due to the gradle architecture when D4 is resolved, it has to check both R2 and R3 => slow and useless. Correct me if I am wrong but if, for example, D1 has a dynamic version (‘1.+’) all repositories will be check => slow and useless since we know that D1 can be found on R1 only.
I think a solution would be the ability to: 1) specify that a dependency can be found only on a set of repository 2) specify that a repository should not be checked for dependency resolution unless it has been explicitly associated with the dependency
Something like that :
repositories {
maven { url:'XXX', name :'R1'}
maven { url:'XXX', name :'R2'}
maven { url:'XXX', name :'R3', implicit:false}
}
dependencies {
runtime group: 'D1', name: 'D1', version: '1.+'
// will be resolved against all "non implicit" repos, here R1 and R2
runtime group: 'D2', name: 'D2', version: '1.2'
runtime group: 'D3', name: 'D3', version: '1.+', repos: ['R2'] // will be resolved against R2 only
runtime group: 'D4', name: 'D4', version: '1.+', repos: ['R2','R3'] // will be resolved against R2 and R3 only
}
Let me know what you think about it. That is personnally something I would love to have, not only for performance. Sometimes I am wondering why R3 has been added and if it is actually used. Here, it is obvious.
I would be glad to see if other people have the same need and if it it is the case I would be glad to implement it!