spring-gradle-plugins / dependency-management-plugin

A Gradle plugin that provides Maven-like dependency management functionality
690 stars 88 forks source link

Allow configurations to be included in and excluded from global dependency management #369

Open wilkinsona opened 10 months ago

wilkinsona commented 10 months ago

At the moment, global dependency management is applied to every visible configuration. This ensures consistency but causes problems like https://github.com/detekt/detekt/issues/6198 and https://github.com/spring-projects/spring-boot/issues/38269. These problems can be avoided today by using configuration-specific dependency management but that's a little cumbersome and makes it hard for users to broaden the dependency management that's been configured elsewhere as it essentially has to be declared again.

It would be useful if it was possible to configure the configurations to which global dependency management applies. For example, Spring Boot could configure global dependency management as it does today but only include certain configurations (compileClasspath, runtimeClasspath, testCompileClasspath, and so on) in that dependency management by default. Users could then include others as needed by doing something like this:

dependencyManagement {
    global {
        configurations {
            include "anotherConfiguration"
            exclude "testRuntimeClasspath"
        }
    }
}

In the example above, global may clash with configuration-specific dependency management for a configuration named global. This could be avoided with some improvements to the DSL.

vcruzmj commented 3 months ago

Are there any updates on this? is make to hard to use detekt with kotlin 2.0.0 and the spring dependency management plugin

wilkinsona commented 3 months ago

None at this time, I'm afraid. We have other higher-priority work and I don't expect a 1.2 release of the dependency management plugin in the near-term. In the meantime, I would recommend using Gradle's built-in platform support in place of the dependency management plugin.