We have plugins applying
resolutionStrategy configurations in
beforeResolve to ensure that dependency locking or resolution rules are applied only before the configuration is resolved. However, we see the following warnings:
Changed dependencies of configuration ‘:compileOnly’ after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0. Use ‘defaultDependencies’ instead of ‘beforeResolve’ to specify default dependencies for a configuration.
beforeResolve only triggers before a configuration is resolved, however it’s considered to have been included in dependency resolution when any of the configurations that it extends from have been resolved.
Unfortunately, the suggested alternative
defaultDependencies isn’t a help as it stands - it appears to fire early enough that we could affect the configuration, in fact it fires after
beforeResolve so gives us the late-as-possible hook we need, but unfortunately it only fires when the configuration is empty.
Given this looming deprecation, how can we reliably configure configurations in this way, when they extend from others? A handler just like
defaultDependencies that always triggers on the same event would be ideal.
Failing test and failing experiment with