编译意义上的sbt编译

编译意义上的sbt编译,sbt,Sbt,有人能解释一下这个神秘的sbt成语中每个compile和compile的意思吗 compile in Compile <<= (compile in Compile).dependsOn(Def.task { println("task is running") // or whatever code here in the body }) 编译中编译 compile是指编译任务,而不是,比如说,package Compile指编译配置(源自/匹配ApacheIvy的配置),

有人能解释一下这个神秘的sbt成语中每个
compile
compile
的意思吗

compile in Compile <<= (compile in Compile).dependsOn(Def.task { 
  println("task is running") // or whatever code here in the body
})
编译中编译
  • compile
    是指编译任务,而不是,比如说,
    package
  • Compile
    指编译配置(源自/匹配ApacheIvy的配置),而不是,比如说,
    Test

<> >如果您在测试中考虑<代码>编译,这是<>代码>编译< /COD>任务范围,适用于Test< /Cult>配置,因此编译测试源。


此外,“unscoped”
compile
键实际上没有在sbt的默认值中定义,因此当您在shell中执行
compile
时,由于sbt的“委托规则”,实际执行的是
compile in compile
,您可以在sbt文档中阅读。

这仍然使事情尽可能神秘:)为什么一个
编译
任务有一个
测试
配置?一个
compile
任务除了编译之外,还能做什么。。。在回答这个问题时,这些问题需要变得非常清楚,我担心
在测试中编译
将编译您的测试源代码<代码>编译
除了编译之外什么都不做,但它是关于它编译什么的。这仍然是相当模糊的。如果我知道
(compile in compile)
在这里扮演什么角色,也许我能够编译出一个连贯的答案。@matt这可能会对你有所帮助,这是“compile”任务键的来源和“compile”的配置源配置测试配置扩展为运行时配置,运行时配置扩展为编译配置,并阅读有关作用域和键的内容此处的作用域为(编译),键为(编译)