My question relates to the first factor of 12 factor apps manifesto: the codebase. (see http://12factor.net/codebase).
TL;DR:
this factor states there's a one to one relationship between codebases and deploys, so in this case, you're not supposed to use the same codebase (repository) for both applications
My requirement: I have an website Spring application and a batch Spring application both sharing a common code i.e. the domain model (JPA entity classes). I need to be able to share this common code. And both applications need to use the same version of the common code at any one time.
My current setup: I have currently three "top-level" repositories on github:
git subtree pull/push
)git subtree pull/push
)Please also note that the Domain model repo lives separately (as noted above) but is also nested within both the website and the batch application repos. I use a git subtree pull/push
in order to include this Domain model repo as a directory and a gradle project within the other two repos. The reason for this is that Heroku builds the code itself from the repos.
All this is very tedious and error-prone.
Can someone please advise a better solution?
I would publish the common code to a private Maven repo on Bintray and then add that private repo to the other consumer apps and specify the common module as a dependency. This doesn't guarantee that both will depend on the same version but that could be easily managed through external processes using tools like the Maven Versions Plugin. But you also might want to add a more flexible serialization system to loosely couple the domain models of the two apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With