How to disable package and publish tasks for root aggregate module in multi-module build?

Instead of playing whac-a-mole by listing specific tasks to disable (publish, publish-local, publish-signed, etc), another option is to turn off artifact publishing at the source. publishArtifact := false Even though there’s no publishing happening, I also found I needed to supply a publishTo value to make sbt-pgp’s publish-signed task happy. It needs this value, even … Read more

How to make “test” classes available in the “it” (integration test) configuration?

You can redefine the IntegrationTest Configuration in your project to extend the Test configuration instead of the Runtime Configuration (the default). This will make everything in your test configuration available to your IntegrationTest configuration. import sbt._ import Keys._ object MyBuild extends Build { val scalaTest = “org.scalatest” %% “scalatest” % “2.0” % “test,it” lazy val … Read more

How to execute tests that match a regular expression only?

Full regular expressions are not supported by testOnly. Wildcards are supported, however. sbt> testOnly com.example.*Spec Only the asterisk * is interpreted specially here and not the periods. This will select all tests beginning with com.example. and ending with Spec. Or just all test Specs: sbt> testOnly *Spec testOnly and other testing information is documented here: … Read more

Create Simple Project SBT 0.10.X

I found the answer I was looking for at this webpage: Scala 2.9.1, sbt 0.10 and ScalaTest step-by-step. The high-level steps are: mkdir my_project make a folder for your project Create a simple my_project/build.sbt file, e.g.: name := “A Project” version := “0.1” scalaVersion := “2.9.1” libraryDependencies ++= Seq( “org.scalatest” %% “scalatest” % “1.6.1” % … Read more

How to support multiple Scala versions in a library

Most of this is well supported in sbt within a single source tree Version specific source directories are usually not need. Scala programs tends to be source compatible – so often in fact that crossbuilding (http://www.scala-sbt.org/release/docs/Detailed-Topics/Cross-Build) has first class support in sbt. If you really need version specific code, you can add extra source folders. … Read more