Coffeescript 附加目录以在SBT设置中监视源

Coffeescript 附加目录以在SBT设置中监视源,coffeescript,playframework-2.0,sbt,Coffeescript,Playframework 2.0,Sbt,我想在watchedSources设置中添加一个目录,以便在我在该目录中保存文件时触发生成任务 override def baseProject = play.Project( moduleName, moduleVersion, dependencies = libraries, path = file(location), settings = moduleSettings ++ Seq( watchSources <++= baseDirectory ma

我想在watchedSources设置中添加一个目录,以便在我在该目录中保存文件时触发生成任务

override def baseProject = play.Project(
  moduleName,
  moduleVersion,
  dependencies = libraries,
  path = file(location),
  settings = moduleSettings ++ Seq(
    watchSources <++= baseDirectory map { dir =>
      Seq(
        dir / "src/main/javascript"
      )
    }
  )
)
override def baseProject=play.Project(
模块名称,
模外翻,
依赖项=库,
路径=文件(位置),
设置=模块设置++顺序(
表源
序号(
dir/“src/main/javascript”
)
}
)
)
我似乎无法回避以下错误:

type mismatch;
[error]  found   : sbt.Project.Initialize[ScalaObject with Equals]
[error]  required: sbt.Project.Initialize[sbt.Task[?]]
[error] Note: ScalaObject with Equals >: sbt.Task[?], but trait Initialize is invariant in type T.
[error] You may wish to define T as -T instead. (SLS 4.5)
[error]     watchSources <++= baseDirectory { f =>
[error]                                     ^
[error] one error found
[error] (compile:compile) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
类型不匹配;
找到[错误]:sbt.Project.Initialize[ScalaObject with Equals]
[错误]必需:sbt.Project.Initialize[sbt.Task[?]]
[错误]注意:带有等于>:sbt.Task[?]的ScalaObject,但特征初始化在类型T中是不变的。
[错误]您可能希望将T定义为-T。(补充说明4.5)
[错误]监视源
[错误]^
[错误]发现一个错误
[错误](编译:编译)编译失败
项目加载失败:(r)etry,(q)uit,(l)ast或(i)gnore?

如何将一系列文件附加到监视源任务的结果中?

我的Play项目也遇到了类似的问题;我希望SBT监视
public/js
以及
test/js
(其中包含测试)对所有JavaScript文件的更改

解决方案是使用SBT表达式指定位置,如下所示:

val main = play.Project(appName, appVersion, appDependencies, settings = Defaults.defaultSettings ++ buildInfoSettings ++ scctSettings).settings(
testOptions in Test += Tests.Argument("junitxml", "console"),
unmanagedResources in Compile ++= (file("public/js") ** "*.js").get,
unmanagedResources in Test ++= (file("test/js") ** "*.js").get,
...
路径查找器是这样一位:
(file(“public/js”)***.js”)
——在其上调用
get
,返回一个
Seq[file]
,我们将其添加到
非托管源中(被认为是被监视的源,但不是理想的Scala)

监视源((Path/“src/main/webapp/coffee”)**“*.coffee”).get}
      watchSources <++= baseDirectory map { path => ((path / "src/main/webapp/coffee") ** "*.coffee").get }