How to create sub projects in Play Framework? (play#play-java_2.9.2;2.1-RC3: not found)

旧城冷巷雨未停 提交于 2019-12-03 12:57:07

Finally got it working:

  • You do not have to delete the Build.scala from the subproject.

You need to rename the routes file of your sub project. In my example, to subProject.routes. If you want to run your subproject in isolation you need to declare that routes must resolve to your subProject.routes. So add this in the application.conf of your subProject:

application.router=subProject.Routes

In your main project, you need to import the routes from the subproject:

->  /subProject               subProject.Routes

And the build file of the main project should look something like: example is from SCALA but s

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "MainProject"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
   javaCore,
   javaJdbc,
   javaEbean 
  )

  val subProject = play.Project(
    appName + "-subProject", appVersion, path = file("modules/SubProject")
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here      
  ).dependsOn(subProject)

}
Ferran Maylinch

I found that I had to explicitly set the scala version to 2.10.0 because the subprojects caused a conflict with 2.9.2.

val main = play.Project(appName, appVersion, appDependencies).settings(
    scalaVersion := "2.10.0"
)

Example taken from this question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!