Versions
- CentOS 6.3
- Oracle Java JDK 1.6
- Scala 2.10.1
- SBT 0.12
- IntelliJ IDEA Community 12.0.4
Prerequisites
Install Plugins
Add the SBT and Scala language plug-ins:
- Click Configure:
- Click Plugins:
- Click Browse repositories:
- Click the search box and enter “scala”:
- Select both SBT and Scala Language plugins by shift-left clicking on them
- Right click on one of the plugins and select Download and Install
- Click Install then Close then Ok and restart IntelliJ IDEA
Try out SBT Console
- After IntelliJ IDEA restarts, either load an existing Scala project or create an empty Scala project
- Click on SBT console in lower left corner:
- Click on the play icon:
- IntelliJ will download SBT and Scala jars then display the SBT command-line:
Configure SBT gen-idea command for the current user
- Make directories if missing:
1mkdir ~/.sbt/plugins - Add the SBT plugin for generating IntelliJ IDEA project files, edit ~/.sbt/plugins/build.sbt:
123resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT") - Load ~/.sbt/plugins/build.sbt, by entering reload in the SBT console:
1234567> reload[info] downloading http://oss.sonatype.org/content/repositories/snapshots/com/github/mpeltonen/sbt-idea_2.9.2_0.12/1.2.0-SNAPSHOT/sbt-idea-1.2.0-SNAPSHOT.jar ...[info] [SUCCESSFUL ] com.github.mpeltonen#sbt-idea;1.2.0-SNAPSHOT!sbt-idea.jar (1309ms)[info] downloading http://repo1.maven.org/maven2/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar ...[info] [SUCCESSFUL ] commons-io#commons-io;2.0.1!commons-io.jar (184ms)[info] Done updating.[info] Set current project to scala.statemachine (in build file:/home/XXXXXX/Code/smach/) - Use any existing build.sbt or create a blank build.sbt (see SBT: Standard build.sbt for Scala) then invoke at SBT console:
1> gen-idea - After downloads complete and generation is complete, click Ok and IntelliJ will restart
Note
the SBT plugin will automatically download the appropriate Scala compiler version. This is a separate instance from any instance of the Scala compiler you may have installed already.