SBT and IntelliJ Idea

Recent versions of Idea (14 at the time of writing) play along quite nicely with SBT (Simple Build Tool - not so simple in fact). It can load project definitions, even when multiple subprojects are defined, and work with them. Unfortunately, it does the reading only once, when you import the project into the IDE. If you update your definitions afterwards, for example, when you add a new dependency, Idea might not be aware of the change. How to fix that?

It is quite simple, actually. From View menu choose SBT (not SB Console which is right next to it) and click the refresh button. It will force the environment to reload the SBT definitions and will update everything there is to update. And that's it, quite simple, actually!

Another thing you could do is to use SBT tasks from Run/Debug configurations in Idea. You can (and probably should) replace the default "Make" task with some corresponding sbt one, say, sbt compile. If you want to debug some unit tests, use sbt test:compile instead, since the regular compile ignores your src/test code and only compiles src/main, which is the right thing to do.

Add new comment

Subscribe to Comments for "SBT and IntelliJ Idea"