SBT stop run without exiting

From sbt version 0.13.5 you can add to your build.sbt cancelable in Global := true It is defined as “Enables (true) or disables (false) the ability to interrupt task execution with CTRL+C.” in the Keys definition If you are using Scala 2.12.7+ you can also cancel the compilation with CTRL+C. Reference https://github.com/scala/scala/pull/6479 There are some … Read more

How to suppress info and success messages in sbt?

sbt 1.x, sbt 0.13.13+ Use -warn or -error. See Fixes with compatibility implications for sbt 0.13.13 release: it is strongly encouraged to migrate to the single hyphen options: -error, -warn, -info, and -debug sbt 0.13.1 To disable info messages run SBT with –warn or –error command line options. To disable [success] messages set showSuccess to … Read more

Run JUnit tests with SBT

Finally, I’ve discovered, that I have to add the following settings to the subproject: lazy val webapp = project settings( Seq( projectDependencies ++= Seq( …. “org.scalatest” %% “scalatest” % “2.2.2” % Test, “junit” % “junit” % “4.11” % Test, crossPaths := false, “com.novocode” % “junit-interface” % “0.11” % Test ) ): _* ) It is … Read more

How to set main class in build?

The main Class must be fully qualified with the package: Compile/mainClass := Some(“myPackage.aMainClass”) This will work for run and it will set the Main-Class in the Manifest when using the package task. The main class for these tasks can be set separately as in: mainClass in (Compile, run) := Some(“myPackage.aMainClass”) mainClass in (Compile, packageBin) := … Read more

Debugging Scala code with simple-build-tool (sbt) and IntelliJ

There’s a very convenient -jvm-debug flag in the official SBT packages for Mac, Linux & Windows. You can use the flag to specify the debug port: sbt -jvm-debug 5005 Under the covers, this starts the JVM for SBT with the typical verbose debugging incantation: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 You now can run your code as normal, for … Read more

Build.scala, % and %% symbols meaning

From the official documentation: http://www.playframework.com/documentation/2.1.1/SBTDependencies Getting the right Scala version with %% If you use groupID %% artifactID % revision instead of groupID % artifactID % revision (the difference is the double %% after the groupID), SBT will add your project’s Scala version to the artifact name. This is just a shortcut. You could write … Read more

tech