我目前正在使用两个SBT子项目:persistence
和silhouette
,dependsOn persistence
。我遇到了silhouette
测试类路径的问题。
persistence
测试运行正常。该子项目在model.persistence
包中声明了一些类。 silhouette
子项目在同一个包中定义了其他类。运行测试时,silhouette
子项目中的其他类无法解析这些附加类。
大多数错误都是:
Error:(7, 31) object routes is not a member of package controllers.silhouette
import controllers.silhouette.routes.{ ActivateAccountController => ActivateRoutes, SignInController => SignInRoutes }
Error:(18, 19) object silhouette is not a member of package views.html
import views.html.silhouette.{ emails => htmlEmail }
我可以看到生成silhouette
子项目中的Twirl视图和路由。它们没有被silhouette
子项目选中,这很奇怪。
以下是SBT子项目定义:
lazy val silhouette: Project = project.in(file("modules/silhouette"))
.configure(webappConfiguration)
.dependsOn(persistence)
.aggregate(persistence)
.settings(
libraryDependencies ++= silhouetteDependencies,
javaOptions += "-Dplay.http.router=silhouette.Routes",
javaOptions in Runtime += "-Dconfig.file=../silhouette/conf/silhouette.application.conf",
javaOptions in Test += "-Dconfig.file=../silhouette/test/resources/test.silhouette.application.conf"
)
addCommandAlias("testSilhouette", "; project silhouette; test")
lazy val persistence: Project = project.in(file("modules/persistence"))
.configure(commonConfiguration)
.settings(
libraryDependencies ++= persistenceDependencies,
javaOptions in Runtime += "-Dconfig.file=../model/src/main/resources/persistence.application.conf",
javaOptions in Test += "-Dconfig.file=../model/src/test/resources/test.model.application.conf"
)
Here is a working project证明了这个问题。
$ sbt ";project persistence; test" # works
$ sbt ";project silhouette; test" # fails as described
答案 0 :(得分:0)
项目定义唯一的错误是silhouette
子项目中缺少依赖项。在我尝试在问题子项目上运行SBT控制台之前,错误消息并没有超级清晰:
$ sbt
[info] Loading global plugins from /home/mslinn/.sbt/0.13/plugins
[info] Loading project definition from /var/work/blah/project
[info] Set current project to Blah (in build file:/var/work/blah/)
[Blah] $ project silhouette
[info] Set current project to silhouette (in build file:/var/work/blah/)
[silhouette] $ console
... compilation errors appeared here...