I edit in the Eclipse Scala IDE and I have my tests running on a separate screen using ~ test
in sbt. My tests are written using specs2.
This gives me double compiles, and sometimes Eclipse is still building while sbt starts to kick in.
To solve this I have turned off automatic building, but that also removes the nice compiler warnings and errors within Eclipse.
Is there a way to have both without double compile times?
I guess the best way (or maybe the only way) is to have sbt
run tests without compiling them. I tried the test:run
command, but that gives me the following error:
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$27$$anonfun$13.apply(Defaults.scala:519)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$27$$anonfun$13.apply(Defaults.scala:519)
at scala.Option.getOrElse(Option.scala:108)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$27.apply(Defaults.scala:519)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$27.apply(Defaults.scala:518)
at sbt.Scoped$$anonfun$hf5$1.apply(Structure.scala:581)
at sbt.Scoped$$anonfun$hf5$1.apply(Structure.scala:581)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
at sbt.std.Transform$$anon$5.work(System.scala:71)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
How could I use ~ test:run
while Eclipse is compiling the files?
With current sbteclipse versions you can use the following setting:
EclipseKeys.eclipseOutput := Some(".target")
The documentation can be found here: Using sbteclipse