At work I built and maintain a large codebase that deploys to multiple servers to perform multiple tasks. We also license software.
The answer to your question is simply libraries and build targets. My monolith is mostly shared code, with unique functionality at the fringes, but it all builds into a single deployable jar, minus the licensed libraries which are special cased.
I'm a huge fan of SBT, despite its dwarf fortress like learning curve.