Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be the minimal setup of IntegrationTest configuration in sbt 0.13.x?

Tags:

sbt

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
like image 835
Jacek Laskowski Avatar asked Oct 21 '13 22:10

Jacek Laskowski


1 Answers

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")
like image 106
Caoilte Avatar answered Nov 09 '22 13:11

Caoilte