Quickstart for using SBT with IntelliJ IDEA.
- Create a new blank repository for your project
- Create a
projectsub-folder - Add the following files to it (tweaking where necessary)
Now you can start sbt (at your project's root folder, not the ./project/ sub-folder), and run the gen-idea command to generate all your IntelliJ IDEA configuration files.
NOTE
If you're going the multi-project route, you'll end up with something like this:
./meta-project
project/$SBT_FILES
widget-core # <- This is a git submodule to another project
src # Project structure...
main/scala
test
# etc...
widgetization # Another submodule/project that depends on widget-core
widget-migrations # Another submodule
acme # A client project submodule that depends on the other projectsNone of your sub-projects would have build files of their own!
That's important. By putting the SBT build files in the meta-project, you can define inter-project dependencies and such. If you had build files in the subprojects sure, they could run standalone if they didn't have dependencies, but Build.scala files aren't recursive, so they couldn't be a "master copy" of your project definitions. You'd have to duplicate the configuration in your meta-project, and maintain the definition in both places.
So I'd recommend just giving up on running the projects standalone for the most part, and depending on running SBT only through your meta-project. The submodules become just a way to organize your code then so if you referenced 20 client projects in your structure, you wouldn't have to clone-the-world necessarily to work on Client-A. You can git submodule init just the client you need.
BTW, I've heard that
build.sbtfiles are recursive. So you could use those if you really wanted. But then you're dealing with slightly different syntaxes, and there's a good chance you'd still needBuild.scalafiles anyways, so it's not really an alternative as much as it is a way to pull out declarative settings like repositories, name, etc.They might ultimately be useful if your build got big enough. It's probably a judgement call more than anything at that point.