Centralize dependency management across projects with a unified Parent POM.
Assuming you, like most, are using Spring Boot. Apply maven and create a common parent pom all your projects will use. Your parent should have spring-boot-dependencies as its parent. Open spring-boot-dependencies.pom and review how it is laid out and how it uses properties to manage versions and dependencyManagement to define dependencies. Do similar in your parent for items Spring does not manage in its parent. Override properties declared in the Spring pom in your pom for items (like netty) which have higher release versions.
Create a baseline project which uses the parent and call mvn versions:display-dependency-updates (and use params which exclude major and minor) to search Nexus / Maven Central for updated versions; don't always trust it. Override properties accordingly. This will save you time searching maven manually for updated versions, but it's fallible.
Organize your properties into "spring overrides" for properties declared in the spring parent, "general overrides" (for dependencies declare that Spring does not manage) and "custom dependencies" (for your in-house jars). Define your general dependencies in the dependencyManagement; this is where you can pre-exclude some dependencies from inclusion.
Keep on top of when Spring Boot Dependencies releases a new version. Save down a copy of that pom and review changes. Update/remove properly overridden "spring overrides" when this happens.
This should get you started.
Remember this is dependencyManagement section, not dependencies. It declares how the dependency is declared, it does not include the dependency.
When you update the parent you update all dependencies on projects you use which refer to the parent version. Reduces overall updates. If a specific project needs a specific version not managed by the parent, either move it to the parent to manage or handle it in the same way locally be separating version as a property. If parent does manage and you need a different version, override the property locally with your declaration of the version.
Remember also mvn dependency:tree exists to track where dependencies come from.
View all comments
0
u/[deleted] 9d ago
[deleted] β view deleted comment