多项目路由不适用于 playframework
Multi project routing does not work on playframework
您好,我正在尝试建立一个多项目 scala playframework 项目,我似乎无法确定我的路由问题。 SBT 一直给我神秘的错误。是否有其他人 运行 遇到此错误。我在这里做错了什么?谢谢!
build.sbt:
name := """server"""
libraryDependencies ++= {
Seq(
guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
)
}
lazy val static = (project in file("modules/static")).enablePlugins(PlayScala)
lazy val main = (project in file(".")).enablePlugins(PlayScala).dependsOn(static).aggregate(static)
conf/routes:
-> /static static.Routes
modules/static/conf/static.路线
GET /static/index controllers.Assets.at(path="/public", file="index.html")
GET /static/assets/*file controllers.Assets.versioned(path="/public", file: Asset)
它给我的错误:
\server\modules\static\conf\static.routes: identifier expected but `.' found.
如果它被编译然后修改为上面的路由,则会给出另一个错误:
play.sbt.PlayExceptions$CompilationException: Compilation error[identifier expected but `.' found.]
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at scala.Option.map(Option.scala:146)
at play.sbt.run.PlayReload$.$anonfun$taskFailureHandler(PlayReload.scala:33)
at scala.Option.map(Option.scala:146)
at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:28)
at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:24)
at play.sbt.run.PlayReload$.$anonfun$compile(PlayReload.scala:51)
at scala.util.Either$LeftProjection.map(Either.scala:573)
at play.sbt.run.PlayReload$.compile(PlayReload.scala:51)
我检查了我的项目(Play 2.6):
conf/routes:
-> / static.Routes
// 在路由脚本的末尾
modules/static/conf/static.路线:
GET /static/index controllers.Default.redirect(to = "/static/index/")
GET /static/index/ controllers.Assets.at(path="/public", file="index.html")
如果我没记错的话 - 缺少斜线是问题所在。
您好,我正在尝试建立一个多项目 scala playframework 项目,我似乎无法确定我的路由问题。 SBT 一直给我神秘的错误。是否有其他人 运行 遇到此错误。我在这里做错了什么?谢谢!
build.sbt:
name := """server"""
libraryDependencies ++= {
Seq(
guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
)
}
lazy val static = (project in file("modules/static")).enablePlugins(PlayScala)
lazy val main = (project in file(".")).enablePlugins(PlayScala).dependsOn(static).aggregate(static)
conf/routes:
-> /static static.Routes
modules/static/conf/static.路线
GET /static/index controllers.Assets.at(path="/public", file="index.html")
GET /static/assets/*file controllers.Assets.versioned(path="/public", file: Asset)
它给我的错误:
\server\modules\static\conf\static.routes: identifier expected but `.' found.
如果它被编译然后修改为上面的路由,则会给出另一个错误:
play.sbt.PlayExceptions$CompilationException: Compilation error[identifier expected but `.' found.]
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at scala.Option.map(Option.scala:146)
at play.sbt.run.PlayReload$.$anonfun$taskFailureHandler(PlayReload.scala:33)
at scala.Option.map(Option.scala:146)
at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:28)
at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:24)
at play.sbt.run.PlayReload$.$anonfun$compile(PlayReload.scala:51)
at scala.util.Either$LeftProjection.map(Either.scala:573)
at play.sbt.run.PlayReload$.compile(PlayReload.scala:51)
我检查了我的项目(Play 2.6):
conf/routes:
-> / static.Routes
// 在路由脚本的末尾
modules/static/conf/static.路线:
GET /static/index controllers.Default.redirect(to = "/static/index/")
GET /static/index/ controllers.Assets.at(path="/public", file="index.html")
如果我没记错的话 - 缺少斜线是问题所在。