Search code examples
sbtsbt-plugin

In SBT, Is it possible to add IntegrationTest config to a project using an AutoPlugin?


I'm developing an AutoPlugin and I want it to add the IntegrationTest config to projects that enable the plugin. Is this possible?

My first thought was this could be possible in the buildSettings, however examples I've seen for adding IntegrationTest config show achieved via a method call on a Project instance... i.e. (from the SBT docs):

lazy val root =
  Project("root", file("."))
    .configs( IntegrationTest )
    .settings( Defaults.itSettings : _*)

Solution

  • Ok, just found this out myself: Just like you can add settings by overriding projectSettings, you can add configs by overriding projectConfigurations.

    Add something like this to your autoplugin:

    override val projectConfigurations = Seq(IntegrationTest)