scala, emacs, sbt 0.10.0, ensime

i’m an ardent emacs user. for our current project we chose the scala language as our programming language along with lift as the web application framework. initially we used maven but have switched over to the simple build tool — sbt in short — about half a year ago, as we found that to be faster than maven and also offering more features (such as test-only, test-quick, etc). to get scala support in emacs i’ve been using ensime which cooperated really well with sbt.

the sbt project recently made version 0.10.0 available — aka sbt10. switching from sbt7.5 to sbt10 is either very easy or a bit of a struggle. it’s easy if you are using a plain vanilla setup. it’s a struggle if you’ve created your own tasks — to paraphrase star trek: “it’s tasks, but not as we know it, jim”.

among the changes brought by sbt10 is that manged JARs are no longer copied into the lib_managed tree (instead the version in $HOME/.ivy2/cache is used, avoiding redundant copies) — that unfortunately confuses the heck out of ensime. florian hars, suffering from the same problem, wrote an sbt10 ensime plugin that fixes the issue for the time being (until ensime has proper sbt10 support).

to install the sbt ensime plugin, follow the instructions in its README, then in restart sbt and invoke the ensime task. after a compile of your project, it will generate a new .ensime project file (save an eventually existing old one if you care about it). then it’s just a restart of emacs and the invocation of ensime.