-
Notifications
You must be signed in to change notification settings - Fork 40.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the automatic import of the spring-boot-dependencies BOM to be disabled in the Gradle plugin #43042
Conversation
Allow the automatic import of the spring-boot-dependencies BOM to be disabled.
@ryanflegel Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@ryanflegel Thank you for signing the Contributor License Agreement! |
Rather than having to opt-out, I wonder if the dependency plugin could offer a fallback option for us to configure? Something that's only used if the coordinates aren't already declared directly. @ryanflegel Will you only need to disable our conventions so that you can include them again in your configuration for ordering? |
Yes, that's the case @philwebb. There's some more info in spring-gradle-plugins/dependency-management-plugin#398. |
Yes, they will be included included manually by importing my own platform BOM. The platform BOM includes spring-boot-dependencies among other things. The issue I'm having with the Boot plugin is that it's re-importing the spring-boot-dependencies BOM and overriding the versions there. In order to avoid this, I'd need to ensure that both the Boot plugin and Dependency Management plugin are applied before I import my platform BOM. It sounds simple, but it's actually very convoluted in a multi-project build where I'm declaring my imports in the root project using I did think about modifying the behaviour of |
We discussed today as a team and decided to reopen spring-gradle-plugins/dependency-management-plugin#398 so that we can provide a fallback/convention option in the dependency-management plugin. Once that's implemented we'll switch to use it in Spring Boot (see #43210). We decided that would probably be better than needing extra configuration. Thanks anyway for the PR @ryanflegel |
Background
The org.springframework.boot plugin automatically imports the spring-boot-dependencies BOM if the io.spring.dependency-management is applied.
While this behaviour is convenient, it overrides explicit configuration done using the dependencyManagement extension, so it does not work as described here:
I have described the issue in greater detail here, where I accidentally submitted an issue to the wrong project.
Proposal
In order to disable the behaviour, I have introduced the property
org.springframework.boot.import-bom
which can be set tofalse
to disabling the import. It defaults totrue
to preserve the current behaviour.Other ideas
I considered using SpringBootExtension instead of a property, but if the io.spring.dependency-management plugin is applied first, then there's no opportunity to configure the extension, since the dependency management configuration happens as soon as the org.springframework.boot plugin is applied. This could be worked around with
afterEvaulate
, but that would be a breaking change since the delaying of the import toafterEvaulate
would mean that spring-boot-dependencies is always imported last (and order is important).