【问题标题】:Why are Play 2.2.3 test templates in a submodule not compiled?为什么子模块中的 Play 2.2.3 测试模板没有编译?
【发布时间】:2014-11-07 03:49:39
【问题描述】:

在我的多模块项目中的一个子模块中的测试需要单独的测试模板,我把它放到test/views/。他们没有被编译。我该如何解决?

我研究了 play sbt 插件源(2.2.x 分支),我发现最接近的是 PlaySettings.scala, line 111

sourceGenerators in Compile <+= (state, unmanagedSourceDirectories in Compile, sourceManaged in Compile, templatesTypes, templatesImport) map ScalaTemplates,

我想,我需要在我自己的build.sbt 中添加一些类似的设置。

UPDATE:问题已解决,请看下面的答案

【问题讨论】:

  • 如果您可以在 github 上提供一个示例项目以在本地进行克隆和测试,那将有所帮助。有太多未知数,我害怕在没有太多帮助的情况下对其进行测试。
  • @JacekLaskowski 感谢您的回复!这是一个示例项目。 github.com/stys/play-223-test-templates 测试模板在主项目中编译失败,所以忘记子模块。运行play test 以查看测试的输出。

标签: sbt playframework-2.2


【解决方案1】:

很接近。可行的解决方案是将以下行添加到项目的build.sbt

sourceGenerators in Test <+= (state, unmanagedSourceDirectories in Test, sourceManaged in Test, templatesTypes, templatesImport) map ScalaTemplates

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-11
    • 2012-04-18
    • 2011-04-07
    • 1970-01-01
    • 1970-01-01
    • 2014-07-03
    • 2012-06-29
    • 2021-11-15
    相关资源
    最近更新 更多