Allow the automatic import of the spring-boot-dependencies BOM to be disabled in the Gradle plugin #43042
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).