Show dependency origin

I’m reading through the Gradle documentation about dependencies. As gradle chooses which repository is used to provide a specific artifact (taking dynamic version etc. into account) providing ‘the best one’, it might be interesting for developers to know what Gradle actually did, and even maybe why (no pom.xml in maven repo, greatest version in my local repo?). Is it somehow possible?


The actual strategy is pretty simple. Gradle only looks at the first repository that contains the dependency. It doesn’t matter if the version is dynamic, Gradle will not look at any more repos if it finds a candidate in a repo.

That said, I think showing the origin in the dependencies report would be useful. I’ve raised GRADLE-2789 for this.

But the documentation (49.7 How dependency resolution works) says:

Once each repository has been inspected for the module, Gradle will choose the ‘best’ one to use. This is done using the following criteria:(…)

So either you are mistaken, or the documentation is wrong, or I’m losing it and can’t understand written text any more ;d


It’s stated in the third point:

Modules from earlier repositories are preferred over modules in later repositories.

Yes, but it doesn’t mean that gradle only looks at the first repository it find the artifact in. If anything, I understand it that it does look at other repositories, otherwise there would be nothing to prefer. You know better of course, but I find it confusing now.