Since you're using IntelliJ 13, you have access to the built in SBT importing; unfortunately this can't be done on an existing project. You can, however, import a project from an SBT Build file, and then migrate over any project settings from the .idea folder (assuming you're using Directory-based Projects).
With that said, it sounds like you also could use some clarification on setting up the Build.scala, so let's dig into that.
Example Play2 Configuration:
I'm going to go ahead and assume you've already created the two Play projects with play new.
We want to set up the project like this:
- ClientPlayProject
- AdminPlayProject
- SharedLibrary
- Project
Assuming a layout like this, here's an example of what a Build.scala might look like:
import play.Project._
import sbt._
import sbt.Keys._
object BuildSettings {
val appOrganization = "com.example"
val appVersion = "0.0.1-SNAPSHOT"
val commonResolvers = Seq(
// Your common resolvers here
)
val commonSettings = Seq(
organization := appOrganization,
// Other shared settings
resolvers ++= commonResolvers
)
val commonDeps = Seq(
// Shared Dependencies for all 3 projects here.
)
val adminDeps = Seq(
// Admin dependencies
) ++ commonDeps
val clientDeps = Seq(
// Client Dependencies
) ++ commonDeps
val libraryDeps = Seq(
// Library Deps
) ++ commonDeps
}
object Build extends Build {
import BuildSettings._
lazy val LibraryProject = Project("SharedLibrary", file("SharedLibrary"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= libraryDeps)
lazy val AdminProject = play.Project("AdminPlayProject", appVersion, adminDeps, path = file("AdminPlayProject"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= adminDeps)
.dependsOn(LibraryProject)
lazy val ClientProject = play.Project("ClientPlayProject", appVersion, clientDeps, path = file("ClientPlayProject"))
.settings(commonSettings: _*)
.dependsOn(LibraryProject)
lazy val aggregatedProjects = Seq[ProjectReference](
LibraryProject,
AdminProject,
ClientProject
)
lazy val root = Project("Root", file("."))
.settings(commonSettings: _*)
.aggregate(aggregatedProjects: _*)
}
As soon as you've got your Build.scala all squared away, just do the Import Project step in IntelliJ and it'll get your code completion all squared away and good to go.
As a note, you may want to break parts of this up into other .scala files and import them; perhaps a Dependencies object, a Resolvers object, etc. It really depends on the complexity level.