Play 框架很新,但我尝试为我的主项目设置子项目,但是当我尝试将路由从主项目重定向到子项目时,它无法识别子项目变量。我根据PlaySubProject此处的文档进行了跟踪
我的主要项目结构如下图所示:
Main
app
conf
application.conf
routes
modules
sub
app
conf
sub.routes
build.sbt
logs
project
public
target
test
activator
activator-launch-1.2.10.jar
build.sbt
这是我的主要 build.sbt 文件:
name := """Main"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava).aggregate(sub).dependsOn(sub)
lazy val sub = (project in file("modules/sub")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs
)
我的子项目 build.sbt 如下:
name := """Subproject"""
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs
)
最后,这是我的主要路线文件。
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
# SUB's
-> /sub sub.Routes
问题出在这个路由文件中,它甚至无法识别最后一行的子变量sub.Routes
。如何解决这个问题呢?