Gradle: Repositories in modules are ignored

Created on 4 Aug 2017  路  3Comments  路  Source: gradle/gradle

Maybe it's a Android specific, but I think, that maybe it's gradle related.

I described it here: https://issuetracker.google.com/issues/64382147
Demo project: https://github.com/mtrakal/issue64382147

you can just call: ./gradlew build --refresh-dependencies to reproduce this issue.

contributor dependency-management

Most helpful comment

Isn't it bad?

  • You are developer of app
  • You have some contractor which provide you module(s), not like aar, but as source codes, because you need sometimes change small pieces before using it
  • contributor provide you update but change libs which he use (and of course repositories)
  • you update your module in project AND...
    ... WHAT, why I can't compile project? Some missing dependencies? WTF, I didn't change anything... :/

Ouch, I updated module, hmm, some new repositories in module. I need to put it into app. Have no idea why (now I have, but not before).

Correct solution:

  • get all repositories from module dependencies, merge them together and then use them as list of dependencies in application module.

All 3 comments

The error is thrown in the app module, which is missing the required repository. Keep in mind that each project resolves dependencies in isolation, using only its own repositories. The fact that module1 has the right repository does not help app, which doesn't have this repository.

Isn't it bad?

  • You are developer of app
  • You have some contractor which provide you module(s), not like aar, but as source codes, because you need sometimes change small pieces before using it
  • contributor provide you update but change libs which he use (and of course repositories)
  • you update your module in project AND...
    ... WHAT, why I can't compile project? Some missing dependencies? WTF, I didn't change anything... :/

Ouch, I updated module, hmm, some new repositories in module. I need to put it into app. Have no idea why (now I have, but not before).

Correct solution:

  • get all repositories from module dependencies, merge them together and then use them as list of dependencies in application module.

We decided not to do this because you would lose control over where the dependencies of your project come from. Choosing your repositories requires trust and it would undermine that trust if other libraries could just bring in new repos.

Was this page helpful?
0 / 5 - 0 ratings