I've the following build.sbt
:
name := "it-config-sbt-project"
scalaVersion := "2.10.4"
Defaults.itSettings
lazy val `it-config-sbt-project` = project.in(file(".")).configs(IntegrationTest)
How could I make the line where I add the IntegrationTest configuration even simpler?
I would rather like to have a setting with current configurations and settings of the project, e.g.
settings ++= Defaults.itSettings
configs += IntegrationTest
or even have the itSettings
settings applied automatically with the following line in the sbt file:
configs += IntegrationTest
I found myself similarly frustrated. The best solution I have found is to borrow from Josh Suereth's Effective SBT slides and create a project helper function that adds the IntegrationTest configuration for you.
eg
object BasePlugin extends Plugin {
val baseSettings = Defaults.itSettings
def baseProject(name: String, location: String = "."): Project = (
Project(name, file(location)) configs(IntegrationTest)
)
}
I pull this and a bunch of other settings in as a plugin and then my build.sbt is as simple as
import caoilte.BasePlugin
BasePlugin.baseSettings
val helloWorld = BasePlugin.baseProject("helloWorld")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With