I have the problem, that I’ve got a enforcedPlatform(..) which want liquibase-core in version 4.x and a platform (spring boot) which does bring 5.x to the table, which I don’t want (yet).
So Gradle does tell me that it does fail to select a version, however I tried different things from the docs to no avail to select the one I want:
Could not resolve org.liquibase:liquibase-core:5.0.2. Required by: project ‘:test’ > org.springframework.boot:spring-boot-dependencies:4.0.6 Component is the target of multiple version constraints with conflicting requirements: 4.33.0 - transitively via ‘project :base’ (runtimeElements) 5.0.2 - directly in ‘org.springframework.boot:spring-boot-dependencies:4.0.6’ (platform-runtime) (1 other path to this version)
did not help.
How can I force gradle to use the version from the enforcedPlatform (I had hopes the enforced one would be preferred to the non enforced one, but it fails nonetheless) I did create via a virtual platform:
Can you share an MCVE, or maybe a build --scan URL?
Generally, enforcedPlatform is seldomly a good idea.
It is a rather heavy almost-last-resort hammer.
Better use a strict version in a normal platform.
But either way, if you have a non-strict / non-enforced version and a strict / enforced version, the strict one will win.
how the situation is exactly in your case is hard to say from this partial description.
org.liquibase:liquibase-core:4.33.0 (by constraint) FAILED
Failures:
- Could not resolve org.liquibase:liquibase-core:{strictly 4.33.0}.
- Component is the target of multiple version constraints with conflicting requirements:
4.33.0 - transitively via 'project :base' (runtimeElements)
5.0.2 - directly in 'org.springframework.boot:spring-boot-dependencies:4.0.6' (platform-runtime)
So how can I tell / force Gradle to prefer the strictly one here?
As I said, impossible to tell without an MCVE or at least a build --scan URL.
I tried what I understood you use and it works as expected.
So without having something concrete to look at, it is hard to say what is relevant in your setup.