I created a scala play project like this
activator new foo play-event-sourcing-starter
the project was generated successfully and I can go inside and easily compile and run the app.
However what I want is that I should have a multi project sbt build. I googled and found this https://www.playframework.com/documentation/2.5.x/SBTSubProjects
But this is not the same as what I want because here they have play as the root project. whereas what I want is that I have an empty root project with a build.sbt file and then multiple "peer" projects. One of them is play.
So I changed the steps to
mkdir -p LearnPlay/project
cd LearnPlay
activator new foo play-event-sourcing-starter
Now I went inside foo and moved the build.sbt
to the LearnPlay directory. I also moved the build.properties
and plugins.sbt
files into LearnPlay/project folder.
I edited the build.sbt file so that the root project becomes
lazy val root = (project in file("foo")).enablePlugins(PlayScala)
However now sbt cannot compile the project anymore and it cannot find any of the play framework dependencies.
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-server_2.10;2.5.9: not found
unresolved dependency: com.typesafe.play#play-netty-server_2.10;2.5.9: not found
unresolved dependency: com.typesafe.play#play-logback_2.10;2.5.9: not found
unresolved dependency: com.typesafe.play#play-test_2.10;2.5.9: not found
unresolved dependency: com.typesafe.play#play-omnidoc_2.10;2.5.9: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
These are the contents of my plugins.sbt file. The resolver is defined correctly so I am not sure why sbt will not be able to find the dependencies after the file was moved from sub-project to root project. it was able to resolve everything when the file was in the project directory of the foo project.
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.9")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")