My organisation modularised their monolith into maven modules in dependencies up to four deep. Originally we used the maven plugin to auto-increment the version numbers in the pom every time someone did a checkin. Then parent dependencies could pull in the updates by updating the version numbers in their pom.xml
.
This lead to a 'fail slow' problem. Imagine the following dependency scenario - where each letter is a module, and each number is a version:
Now imagine we make a series of changes to D and B and A, forgetting C.
C has gotten left behind (and is still pointing to an old version of D).
Now when the person who has to make a change to C does it - they find that all the changes to D have broken C in multiple ways. Fixing C now takes days.
So the team came up with a different plan. Fail fast.
Now everything that was a version number above is now LATEST
. (Note this is maven 2 not maven 3).
This means that any breaking change to D, will show up in B or C the next time it is built. (The key phrase here being the next time it is built).
Now let's assume that module A is the parent web application that developers use. Now a developer checks in a change to B - for which B compiles (and A works on their machine). A however has had several checkins - and the version of B:LATEST now breaks with A:LATEST.
We have a fail-fast strategy - but there is nothing in version control to show what broke the app. (And potentially 40 modules to look at to see what the root cause is.)
The challenge is that you can now have 50 developers whose build is broken, who didn't make a change on their machine - nor see anything in version control. All because their machine pulled in latest from artifactory.
We've had several suggestions to make this better:
- In the CI tool - tie changes in the module to trigger rebuilds of the parent web app
- In the CI tool - make module builds email the developers so they know what is going on
- In the CI tool - make the module build write a 'build message' to a log file in the git repository of the parent web app.
The latest recommendation has been to change the parent web app to version numbers and leave the grandchild modules to LATEST
.
Note that for releases - we increment the module versions back to fixed versions.
My question is: What is a good versioning strategy to achieve 'fail fast' with chains of dependent maven submodules?