I've been working on building an application with Akka actors, and now that I've completed the actor-based business logic I'd like to give it a RESTful + websocket front-end. I'm trying to find instructions for how to setup Play within the context of an existing application. The only instructions I could find are how to create new Play applications. Is there any documentation on how to do this?
UPDATE: This question has more to do with the SBT setup than connecting the controllers to my actor based business logic. I tried to modify build.sbt
and plugins.sbt
to include the things that activator built when I did activator new
but IDEA is complaining about Cannot resolve symbol PlayScala
. Also I am wondering about moving my actors from the SBT-standard src/main/scala
to app/
-- should it be in app/actors
(as I saw in one of the templates) or in app/models
?
Here's my build.sbt
:
name := "test"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(play.PlayScala)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
specs2 % Test
)
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
scalaVersion := "2.11.6"
resolvers += "repo.novus rels" at "http://repo.novus.com/releases/"
resolvers += "repo.novus snaps" at "http://repo.novus.com/snapshots/"
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.1" % "test"
libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "1.8.0"
libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.6.4"
libraryDependencies += "org.reactivemongo" %% "reactivemongo" % "0.10.5.0.akka23"
routesGenerator := InjectedRoutesGenerator
and here is my plugins.sbt
:
logLevel := Level.Warn
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
UPDATE Answer:
Start in your Project File the activator
Then start the web App with run
and open the browser with http://localhost:9000
This loads all the dependencies and compiles the Scala Play Application.
This should correct your IDEA Ide Problems about missing Dependencies.
In Scala Play 2.4 you can choose between to Project Layouts.
app/
src/main/scala
used by SBT and Maven Project is new and experimental and may have issues.Before (Play 2.3 and smaller)
there where only the Project layout app/
The three Packages
app/controllers -> Application controllers
app/models -> Application business layer
app/views -> Templates
are predefined.
You can of course add your own packages, for example an app/actors
package.
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