Search code examples
scalaintellij-ideabuildsbtdirectory-structure

IntelliJ configure own SBT folder structure


I want to use my very own folder structure for a SBT-project in intellij.

So I configure it in the project structure settings menu.

I want the folders to be like this:

src
- main
- test
res

I do not want any java, scala or whatever folders. Now, this kind of works, until I add another dependency in my build.sbt. As soon as I do that, everything resets and I have to do reset all the settings manually. I'm kind of desperate now. I just want my folder structure to work.

Any ideas why this always resets?


Solution

  • The structure is decided settings in your sbt build, when you change the build.sbt file IntelliJ needs to rebuild its own internal model of the project and reloads that from SBT which resets changes you have done in IntelliJ.

    I'm not sure how good it will work in IntelliJ with custom paths but you should be changing scalaSource (and possibly javaSource) in your build.sbt rather than through the IntelliJ menus.

    You can read more about the sbt source configuration keys here: http://www.scala-sbt.org/0.13/docs/Classpaths.html