Maven dependencyManagement Version Conflict - Pin in CI
Two managed entries (often from competing BOM imports) resolve the same artifact to different versions. Maven picks by declaration order, so the version you get may not be the one you expect, breaking the build at compile or runtime.
What this error means
A compile error about a missing class/method, or a runtime NoSuchMethodError, traces back to a transitive library resolving to an unexpected version. mvn dependency:tree shows the version chosen by dependencyManagement, not the one you intended.
[INFO] com.example:app:jar:1.0.0
[INFO] +- org.springframework:spring-core:jar:6.0.11:compile (managed from 6.1.4)
[INFO] \- com.acme:lib:jar:3.0.0:compile
[INFO] \- org.springframework:spring-core:jar:6.1.4 (omitted for conflict)Common causes
Two BOMs pin the same artifact differently
Importing two BOMs (e.g. a platform BOM and a framework BOM) that both manage the same artifact means the first-declared import wins, regardless of which version you actually want.
A stale managed version shadows the intended one
A <dependencyManagement> entry left from an earlier upgrade forces an old version even though direct dependencies expect a newer one.
How to fix it
Inspect and pin the conflicting artifact
Find which managed entry wins, then pin the version explicitly so it is unambiguous.
mvn dependency:tree -Dincludes=org.springframework:spring-core
# then pin it:
# <dependencyManagement><dependencies>
# <dependency>
# <groupId>org.springframework</groupId>
# <artifactId>spring-core</artifactId>
# <version>6.1.4</version>
# </dependency>
# </dependencies></dependencyManagement>Order BOM imports so the intended one wins
- Place the BOM whose versions should take precedence first in
<dependencyManagement>. - A directly declared managed version overrides any imported BOM, so pin the artifact you care about.
- Add the enforcer dependencyConvergence rule to fail fast on future conflicts.
How to prevent it
- Pin contested artifacts directly in dependencyManagement, keep BOM import order intentional, and enforce convergence so conflicts fail the build early.