Hello folks,
in the last few days there were multiple incidents related to snapshots in our monorepo, such as a module deletion causing other team's jar to stop working correctly in monorepo since snapshots can't be downloaded by monorepo's gradle, or a snapshot becoming invalid due to a new dependency (the correctness of said module being snapshotted not withstanding). So let's reiterate a few points regarding snapshots and how it's related to multi repository project and monorepo in general.
The first sticking point is the way teams moving an already snapshotted module to their repo, since there are no standardized way yet. So here is one:
M
for simplicity) into the new repo, change only the gradle file as necessary and publish it as a jar (MJ
for simplicity)
M
has been moved, tagging the teams listed in the willBePublished clause since they already make it clear they need M
(and MJ
by extension) and have to change their own jar as well. Also put a deadline on when teams are expected to publish their new jars that use MJ
instead of M
.
M
in monorepo and change the gradle to just depend on MJ
. Land this diff soon after the announcement above. Check business-platform/traveloka-business-integration-api
for example. (If you want to be safe, you can generate global.lock too)
M
snapshot anymore), you can delete M
from monorepo. Don't forget to update willBePublished.json and generate global.lock to ensure no problem is caused by the module removal
this procedure should also be followed in case a module that is already snapshotted is removed / not snapshotted anymore, such as for an extra impl module.
The steps above also requires changes in how teams work in multi repository to ensure maximal effectiveness, which are:
The last sticking point is on keeping snapshotted modules' dependency clean. For this, owners of those modules have to be aware regarding the snapshot status (you should be, the review that adds the willBePublished clause must be approved by you after all) and should take extra care in introducing new dependencies. Make sure those new dependencies are also already snapshotted if possible. If not, you have to inform other teams that you will have to make a major change regarding the module, perhaps creating a new module just for necessary classes for other teams.
That's all. This guide will also be reflected at the snapshot confluence page https://29022131.atlassian.net/wiki/spaces/BEI/pages/758743904/How+to+Enable+Migrations+Using+Snapshots+in+old-monorepo.