Maven hell: building dependent starters with one workflow
· 4 min read · Maven · BOM · CI
At some point, hermesproject had grown to around 90 repositories. About 25 of them were starters and libraries that made up the core of the system. Keeping all of that up to date was becoming a pain.
Update one, then another, and keep going round. The starters also depended on each other. For example, we have this chain:
r2dbc-model
→ r2dbc-starter
→ dbqueue-starter
→ outbox-event-starterThe last one also depends on kafka-starter. So an update meant keeping track of both the versions and the release order of all these libraries. We had managed to give ourselves our own Maven hell.
I took a look at how Spring handles this and created a separate BOM repository, hp-bom. I put the versions of our starters there and gave them a shared version number. Inside the BOM, they use ${project.version}. A service can then choose a version of hp-bom to get the corresponding set of internal library versions. External dependencies kept their own version numbers.
But the starters still needed to be released. So I built a job that updated them all to the same version and ran the builds in the right order.

Putting it into one job
ORCHESTRATE-STARTER-ALL takes one input: the version we want to release. The libraries then go through a series of phases.
First come the base models and starters such as logging-starter and util-starter. Then the libraries that depend on them. For example, r2dbc-starter has to be ready before dbqueue-starter, which has to be ready before outbox-event-starter.
Repositories within a phase form a GitHub Actions matrix, so they can build in parallel. Each phase waits for the previous one to finish successfully. If a build fails, the release stops moving down the chain.
hp-bom is published last, once all the library phases have passed. Otherwise, it would point to versions that had not yet reached the Maven repository.

A shared action called release-or-wait handles each repository. It creates the release if it does not already exist, then waits for that repository’s release.yml to finish. Sending a request to create a release is not enough: the build can still fail, and the library may never be published.
The whole release can stop when some starters have already been published. The job does not roll those publications back. A failed release needs attention; the action does not try to recreate a release that already exists.
The services still need updating
Once the starters were released, there were still the services. Each had its own pom.xml with an hp-bom version, and I did not want to go through those one by one either.
That led to a second job, ORCHESTRATE-BOM-BUMP. It takes the new BOM version and a list of services. You can select a few repositories or all the entries in our matrix.

The job goes through them and uses the GitHub API to update the hp-bom version in each pom.xml. If the right version is already there, it leaves the file alone.

The regular service CI also has a bom-guard. It checks whether the BOM version in pom.xml matches the latest version in Nexus. If it does not, the main build will not start. The dependency has to be updated first.
This is a fairly strict rule: a service with an old BOM cannot build through this workflow, even if its code has not changed. A new core release means the consumers need to catch up as well.
The setup needs maintenance too. The phase order lives in the workflow, and the service list lives in a separate matrix. Adding a library or service means updating the relevant lists. The job does not discover new repositories automatically.
This got us out of the manual starter-update loop that had been causing the trouble.