Reputation: 8026
I'm working with a multi module IDEA project in scala.
The project contains 16 modules.
All of those modules are based on the same common sbt config :
resourceDirectory in Compile := baseDirectory.value / "src" / "main" / "resources",
resourceDirectory in Test := baseDirectory.value / "src" / "test" / "resources",
resourceDirectory in IntegrationTest := baseDirectory.value / "src" / "it" / "resources",
My problem is that when syncing the project with IDEA, 2 of the 16 modules will consistently fail to mark their src/main/resources folder as resources root
, but will instead have it flagged as test resources root
I can change it manually, but every single reimport of the project will re-flag them again.
After a bit of digging in sbt, I found that from sbt of point of view :
Thanks !
Minimal build.sbt that will exhibit the problem :
import sbt.Keys.resourceDirectory
lazy val coreSettings = Seq(
organization := "C4stor",
scalaVersion := "2.12.6",
resourceDirectory in Compile := baseDirectory.value / "src" / "main" / "resources",
resourceDirectory in Test := baseDirectory.value / "src" / "test" / "resources",
resourceDirectory in IntegrationTest := baseDirectory.value / "src" / "it" / "resources"
)
lazy val `module_one` = project
.in(file("module_one"))
.settings(
coreSettings
)
.configs(IntegrationTest)
If you create the actual src/main/resources and src/test/resources folders in module_one directory, IDEA will incorrectly flag src/main/resources
Upvotes: 3
Views: 412
Reputation: 8026
Every module that has .configs(IntegrationTest)
also needs to have Defaults.itSettings in its settings in order for idea to correctly map resources folders.
In the example given, it becomes
lazy val `module_one` = project
.in(file("module_one"))
.settings(
coreSettings, Defaults.itSettings
)
.configs(IntegrationTest)
Upvotes: 1