I’ve got a plugin whose job is to add dependencies to a project. It uses a DSL extension to decide which dependencies to add.
It’s only 20 lines, if you’d like to take a look.
Right now I’m adding dependencies in
Project.afterEvaluate. It works, but if I use it in a multi-project build then I get this warning:
Changed dependencies of configuration 'xxxx:compile' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0.
So then I tried
Project.beforeEvaluate, which doesn’t work at all (no errors, but the dependencies just don’t get added).
When can a plugin change a project’s dependencies? If I just do it immediately in the apply method, then the DSL extension won’t be populated by the buildscript…