Reputation: 1351
In SBT, compile
task does the compilation of the project code and test:compile
does compilation of the project's tests. I want a single compile
task which does both. I want to override the default compile
task and dont want a task with a new name (because want to enforce compilation success of all tests with every code change to project's main code). Am using Build.scala (not build.sbt) and tried the method described in this SO answer. My trial is pasted below and does not work because the return type of the compile
task is TaskKey[Analysis]
. How should I change this?
val compileInTest = TaskKey[Analysis]("compile the tests")
compileInTest := {
(compile in Compile in <module-name>).value
(compile in Test in <module-name>).value
}
lazy val projectA = Project(
"a",
file("a"),
settings = hwsettings ++ Seq(
compile := compileInTest
))
Upvotes: 3
Views: 805
Reputation: 6385
You can define alias in .sbtrc
file:
alias compile=test:compile
which will do both tasks.
Upvotes: 3