I have 2 projects, which are developed using PlayFramework 2.4. Although they are completely separate in concept, they share some common features, like evolution management (Liquibase), CRUD administrative mechanism, notification (email, sms) mechanism, etc. So, it was decided to split every project in 2 modules: common "core" module, which holds all described logic, and "project" module, which hold project-specific services, templates, views.
Recomended approach for achieving this in Play Framework is "subproject" concept. But it's clearly not an option, due to at least two reasons:
- Projects are developed by different teams, that's why they they can't be located in one directory structure
- These 3 modules ("core" and 2 "project" modules) MUST be versioned in separate VCS repos (Mercurial)
My current solution is to create core module, and provide it as a dependency in "project" Play application. An though this approach partially works, there are major downsides:
- If you add routes file in module, they will override project routes file
- You cant place views in core module, because due to fig.1 you cant access public assets
- Due to downside n.1 and 2, you cant place Controllers in core module, because you cant specify a view to render
- static assets (public directory) is not included in module distribution
I'm forced to copy common templates into both projects, I practically can't write common controllers which is annoying SO much
Appreciate any help. Maybe this can be achieved in some sort of highly-custom build and publish process for the core module?