嗨,我正在尝试设置一个多项目 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)
参考/路线:
-> /static static.Routes
modules/static/conf/static.routes
GET /static/index controllers.Assets.at(path="/public", file="index.html")
GET /static/assets/*file controllers.Assets.versioned(path="/public", file: Asset)
它给我的错误:
servermodulesstaticconfstatic.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$1(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$3(PlayReload.scala:51)
at scala.util.Either$LeftProjection.map(Either.scala:573)
at play.sbt.run.PlayReload$.compile(PlayReload.scala:51)
我检查了我的项目(Play 2.6(:
参考/路线:
-> / static.Routes
//在路由脚本的末尾
modules/static/conf/static.routes:
GET /static/index controllers.Default.redirect(to = "/static/index/")
GET /static/index/ controllers.Assets.at(path="/public", file="index.html")
如果我没记错的话 - 缺少斜杠是问题所在。