我有一个多项目sbt编译,我想用https://github.com/softprops/coffeescripted-sbt将我的coffeescript编译为javascript,但它不执行任务。使用coffeescripted-sbt在多项目编译中编译coffeescript
的代码是从https://github.com/jeffmay/angular-play-multimodule-seed/tree/stackoverflow-17289043
采取build.sbt
即使不建议这样做,我为了测试此混在项目目录中build.sbt文件与我的项目对象插件工作。
在build.sbt
:
seq(coffeeSettings: _*)
当我跑:
$ sbt
[info] Loading project definition from /Users/jeffmay/code/righttrack/project
[info] Set current project to root (in build file:/Users/jeffmay/code/righttrack/)
> coffee
[success] Total time: 0 s, completed Jun 24, 2013 11:40:37 PM
> show coffee
[info] ArrayBuffer()
[success] Total time: 0 s, completed Jun 24, 2013 11:40:52 PM
> project web
[info] Set current project to web (in build file:/Users/jeffmay/code/righttrack/)
[web] $ coffee
[error] Not a valid command: coffee
[error] No such setting/task
[error] coffee
[error] ^
[web] $
是什么ArrayBuffer()
意思?那是一个无声的故障(CoffeeScript的返回最后一个表达式,否则将是一个的null
return;
?)
多项目设置
对于某些方面,我打造的是爆发了,像这样......
在project/plugins.sbt
:
// SBT community plugin resolver
resolvers += Resolver.url("sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
// CoffeeScript compiler plugin
addSbtPlugin("me.lessis" % "coffeescripted-sbt" % "0.2.3")
在project/Modules.scala
(我的生成对象):
import sbt._
object Modules extends Build {
lazy val root = RootModule.project
lazy val api = ApiModule.project
lazy val web = WebModule.project
}
在project/WebModule.scala
:
object WebModule extends BaseModule {
// ... libraries dependencies and stuff
override def project = play.Project(moduleName, moduleVersion, libraries, file(location),
moduleSettings ++
Seq((resourceManaged in (Compile, CoffeeKeys.coffee)) <<= (crossTarget in Compile)(_/"src"/"main"/"coffee"))
)
}
我用project/BaseModule.scala
删除每个模块的共同要素的混乱,但它没有做任何幻想。
随着Build.scala
我删除build.sbt
的东西,并把它变成Build.scala
通过project/WebModule.scala
加入:
override def project = play.Project(moduleName, moduleVersion, libraries, file(location),
moduleSettings ++
coffeeSettings ++ // With the settings moved from build.sbt
Seq((resourceManaged in (Compile, CoffeeKeys.coffee)) <<= (crossTarget in Compile)(_/"src"/"main"/"coffee"))
)
然后我给它一个旋转
$ sbt
[info] Loading project definition from /Users/jeffmay/code/righttrack/project
[info] Set current project to root (in build file:/Users/jeffmay/code/righttrack/)
> coffee
[error] Not a valid command: coffee
[error] No such setting/task
[error] coffee
[error] ^
> project web
[info] Set current project to web (in build file:/Users/jeffmay/code/righttrack/)
[web] $ coffee
[success] Total time: 0 s, completed Jun 25, 2013 12:08:36 AM
[web] $ show coffee
[info] ArrayBuffer()
[success] Total time: 0 s, completed Jun 25, 2013 12:08:40 AM
我运行咖啡命令后没有看到任何更改。任何想法是什么问题?
谢谢!