Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt compile in Compile meaning

Tags:

sbt

Can someone kindly explain what each compile and Compile mean in this cryptic sbt idiom:

compile in Compile <<= (compile in Compile).dependsOn(Def.task { 
  println("task is running") // or whatever code here in the body
})
like image 420
matanster Avatar asked Jul 02 '15 07:07

matanster


1 Answers

  • compile means the compile task, as opposed to, say, package
  • Compile means the compile configuration (derived from/matches Apache Ivy's configurations), as opposed to, say, Test

It might be easier to understand if you consider compile in Test which is the compile task scoped to the Test configuration and therefore compiles the test sources.

Moreover, the "unscoped" compile key isn't actually defined in the defaults of sbt so when you execute compile in the shell what's actually executed is compile in Compile due to sbt's "delegation rules", which you can read about in the Scope delegation sbt docs.

like image 66
Dale Wijnand Avatar answered Oct 23 '22 13:10

Dale Wijnand