intellij-ideasbtsbt-idea

Exclude sbt subproject from IDEA import


I have helper projects in build.sbt just so I can invoke plugins with different configurations, i.e.:

lazy val root = project.in(file(".")).aggregate(app, cfg1, cfg2)

lazy val app = project.in(file("modules/app"))

lazy val cfg1 = project.in(file("target/cfg1"))
  .enablePlugins(SomePlugin).settings(somePluginOption := "a")

lazy val cfg2 = project.in(file("target/cfg2"))
  .enablePlugins(SomePlugin).settings(somePluginOption := "b")

This way I can execute them as needed (sbt cfg1/someTask).

IDEA adds these projects on import/sync just like any other subproject, which is expected because there is nothing special about them however I do not want them in IDEA.

Is there a way to exclude them from being imported by IDEA?


Solution

  • Looks like it is possible with https://github.com/JetBrains/sbt-ide-settings

    lazy val cfg2 = project.in(file("target/cfg2"))
      .enablePlugins(SomePlugin)
      .settings(
        somePluginOption := "b",
        ideSkipProject := true
      )