Category Archives: sbt

SBT: Standard build.sbt for Scala


Version

  • Scala 2.11.0

A basic build.sbt template:

Note

replace XXX below

Example:

IntelliJ IDEA: Configure for Scala and SBT


Versions

  1. CentOS 6.3
  2. Oracle Java JDK 1.6
  3. Scala 2.10.1
  4. SBT 0.12
  5. IntelliJ IDEA Community 12.0.4

Prerequisites

  1. CentOS 6: Install IntelliJ IDEA

Install Plugins

Add the SBT and Scala language plug-ins:

  1. Click Configure: intellij_idea_configure.png
  2. Click Plugins: intellij_idea_plugins.png
  3. Click Browse repositories: intellij_idea_browse_repositories.png
  4. Click the search box and enter “scala”: intellij_idea_plugin_search_box.png
  5. Select both SBT and Scala Language plugins by shift-left clicking on them
  6. Right click on one of the plugins and select Download and Install intellij_idea_download_and_install.png
  7. Click Install then Close then Ok and restart IntelliJ IDEA

Try out SBT Console

  1. After IntelliJ IDEA restarts, either load an existing Scala project or create an empty Scala project
  2. Click on SBT console in lower left corner: intellij_idea_sbt_console.png
  3. Click on the play icon: intellij_idea_sbt_play.png
  4. IntelliJ will download SBT and Scala jars then display the SBT command-line: intellij_idea_sbt_command-line.png

Configure SBT gen-idea command for the current user

  1. Make directories if missing:
  2. Add the SBT plugin for generating IntelliJ IDEA project files, edit ~/.sbt/plugins/build.sbt:
  3. Load ~/.sbt/plugins/build.sbt, by entering reload in the SBT console:
  4. Use any existing build.sbt or create a blank build.sbt (see SBT: Standard build.sbt for Scala) then invoke at SBT console:
  5. 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.