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 :
- For all 16 modules, src/main/resources is the resource directory for Compile
- For all 16 modules, both src/main/resources and src/test/resources are resources directories for test, which I find a bit odd, but I'm not sure.
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