My team is looking to re-architect one of our applications in Play2. The application is split up into two web applications that sit on top of the same database: client(read) and admin(read/write).
In the new architecture, we're looking to build two Play2 servers that expose a REST API. There will be two single-page AngularJS apps sitting in front of each. But both servers share common functionality. So we're looking to build a common library which will expose the data access layer (models and DAOs). Each server will have its own set of services.
Client (REST server): read
Admin (REST server): read/write (full CRUD)
I'm using IntelliJ 13 and am having a hard time setting this up. I've taken a look at the following sources:
http://www.playframework.com/documentation/2.2.1/SBTSubProjects
http://www.scala-sbt.org/release/docs/Getting-Started/Multi-Project
I believe what I want is add the library type dependency as a (Import Module...), in contrast to adding a module to the parent project
myProject
myLibrary
I solved the problem by abandoning SBT as my dependency/build tool. I ended up using Maven via a plugin (http://nanoko-project.github.io/maven-play2-plugin/maven/release/index.html). The plugin works great. Maven is used as in traditional Java applications.
I created a three pom.xml files for each "project" (Client, Admin, shared library), and an additional pom.xml for parent. Nothing new here. Just your typical Maven setup for multi-project dependencies.
Like I said, the Play2 Maven Plugin works great! I highly recommend it for complicated Play2 applications involving project dependencies.