Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply exclusions earlier to avoid deprecation warning
Previously, the dependency management plugin used a before resolve action to apply Maven-style exclusions. Gradle performs configuration resolution in two passes and, despite its name, a before resolve action is called after the first pass. With Gradle 8.8 and later, using a before resolve action to configure the exclusions can result in a deprecation warning. The deprecation warning states that support for mutating the dependency attributes of a configuration after it has been resolved has been deprecated. This commit addresses the deprecation warning by configuring the exclusions earlier, in the withDependencies callback. The callback is called before the first pass of the resolution process, thereby avoiding the warning. Configuring the exclusions at this step prevents the exclusions from being configured on a per-dependency basis so they are now configured on the configuration. Without any additional changes, this regresses the fix for gh-21 as the exclusions are now inherited and cause an exclusion in one configuration where it should apply to leak into another configuration where it should not. To overcome this regression, exclusions are only applied to configurations that can be resolved. Typically, these are configurations like compileClasspath, testRuntimeClasspath and so on, that are leaves and are not extended by other configurations, thereby minimizing the risk of any inheritance-related problems. Closes gh-384
- Loading branch information