Wednesday 15 September 2010

Creating Intellij Projects for SBT Projects

I'm currently working on an Open-Source Scala project and we have switched our build process from Maven2 to SBT or Simple Build Tool http://code.google.com/p/simple-build-tool/. We've mainly done this as our project will be based on the Akka and the Lift framework which have also now switched to SBT.

SBT provides many of the features of Maven such as loading dependencies from remote repositories but is much simpler and the configuration is done in Scala rather than using messy xml files.

As part of this project I have found that JetBrains IntelliJ IDEA Community Edition seems to be the best Scala IDE I have tried and also has an SBT plug-in. As a bonus SBT has an action which will generate an Intellij IDEA project file configured to work with SBT.

To use this, go to the root of your SBT project and type sbt to start sbt, then enter:


*sbtIdeaRepo at http://mpeltonen.github.com/maven/
*idea is com.github.mpeltonen sbt-idea-processor 0.1-SNAPSHOT
update
idea


This will generate the .ipr file which you can then use


==============================================================

Update

Plug-ins are now stored globally in a $HOME/.sbt/plugins/build.sbt or C:\Documents and Settings\username\.sbt\plugins file which for this plugin the following contents should be added:

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

libraryDependencies += "com.github.mpeltonen" %% "sbt-idea" % "0.10.0"
Also the task is now called gen-idea

Note: In window use the command line to create a .sbt directory

1 comment:

Unknown said...

Thanks a lot, very useful!