【问题标题】:SBT has added Emacs temp files to managedSourcesSBT 已将 Emacs 临时文件添加到 managedSources
【发布时间】:2014-07-18 13:37:55
【问题描述】:

我正在使用 Scala 完成 Play 2 框架的教程,并在尝试编译时遇到此错误:

[playProducts] $ compile
[trace] Stack trace suppressed: run last compile:managedSources for the full output.
[error] (compile:managedSources) java.io.FileNotFoundException:
/Users/peterbecich/scala/playProducts/app/views/tags/.#barcode.scala.html
(No such file or directory)

托管来源列表不可见。

[playProducts] $ show managedSources
[trace] Stack trace suppressed: run last compile:managedSources for the full output.
[error] (compile:managedSources) java.io.FileNotFoundException:
/Users/peterbecich/scala/playProducts/app/views/tags/.#barcode.scala.html (No such file or directory)

非托管源是可见的,并且没有列出临时文件。

[playProducts] $ show unmanagedSources
[info] ArrayBuffer(/Users/peterbecich/scala/playProducts/app/controllers/Application.scala, /Users/peterbecich/scala/playProducts/app/controllers/Barcodes.scala, /Users/peterbecich/scala/playProducts/app/controllers/Products.scala, /Users/peterbecich/scala/playProducts/app/models/Product.scala)

解决方案是否类似于在 build.sbt 中包含类似的内容?这并没有解决它,显然不是所有临时文件的解决方案。你可以在 SBT 配置文件中使用正则表达式吗?

excludeFilter in managedSources := ".#barcode.scala.html"

我在 Mavericks 上使用 Oracle JDK 8。我应该降级到 JDK 6 还是 7? SBT 是 0.13.5,Play 是 2.2.3,Scala 是 2.10.3。

这是完整的编译错误:http://pastebin.com/gGGmUE3f

感谢您的反馈!

【问题讨论】:

    标签: playframework-2.0 sbt


    【解决方案1】:

    不幸的是,在 Play 2.2.x 中没有什么可以做的......这是找到所有模板的代码:

      sourceDirectories.foreach { sourceDirectory =>
        (sourceDirectory ** "*.scala.*").get.collect(templateExt).foreach {
    

    它没有提供任何过滤的机会:(

    但是,在 Play 2.3 中,我们重写了模板编译器的 SBT 部分(现在称为 Twirl),现在可以正确定位源文件(即使用标准 SBT 机制),因此您可以:

    excludeFilter in TwirlKeys.compileTemplates := ".#*"
    

    虽然这实际上甚至没有必要,因为默认的排除过滤器会排除所有隐藏文件,其中包括 emacs 文件,因为它们以 . 开头。

    【讨论】:

      【解决方案2】:

      奇怪的是,退出 Emacs 已修复 sbt compile

      我使用的是 Emacs 插件 Ensime,如果这很重要的话。

      sbt clean 没有解决问题,也没有删除所有目标目录,例如:https://stackoverflow.com/a/18045926/1007926

      【讨论】:

        猜你喜欢
        • 2017-04-22
        • 1970-01-01
        • 2017-07-04
        • 2016-02-07
        • 1970-01-01
        • 2013-03-15
        • 2018-04-16
        • 1970-01-01
        • 2018-09-26
        相关资源
        最近更新 更多