Skip to content

Getting Started Setup

Mark Harrah edited this page May 31, 2012 · 38 revisions

Setup

Previous Getting Started Guide page 2 of 14. Next

Overview

To create an sbt project, you'll need to take these steps:

  • Install sbt and create a script to launch it.
  • Setup a simple hello world project
    • Create a project directory with source files in it.
    • Create your build definition.
  • Move on to running to learn how to run sbt.
  • Then move on to .sbt build definition to learn more about build definitions.

Installing sbt

You need two files; sbt-launch.jar and a script to run it.

Note: Relevant information is moving to the download page

Yum

The sbt package is available from the Typesafe Yum Repository. Please install this rpm to add the typesafe yum repository to your list of approved sources. Then run:

yum install sbt

to grab the latest release of sbt.

*Note: please make sure to report any issues you may find here.

Apt

The sbt package is available from the Typesafe Debian Repository. Please install this deb to add the typesafe debian repository to your list of approved sources. Then run:

apt-get install sbt

to grab the latest release of sbt.

If sbt cannot be found, dont forget to update your list of repositories. To do so, run:

apt-get update

*Note: please make sure to report any issues you may find here.

Mac

Use either MacPorts:

$ sudo port install sbt

Or HomeBrew:

$ brew install sbt

There is no need to download the sbt-launch.jar separately with either approach.

Windows

You can download the msi

or

Create a batch file sbt.bat:

set SCRIPT_DIR=%~dp0
java -Xmx512M -jar "%SCRIPT_DIR%sbt-launch.jar" %*

and put sbt-launch.jar in the same directory as the batch file. Put sbt.bat on your path so that you can launch sbt in any directory by typing sbt at the command prompt.

Unix

Download sbt-launch.jar and place it in ~/bin.

Create a script to run the jar, by placing this in a file called sbt in your ~/bin directory:

java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@"

Make the script executable:

$ chmod u+x ~/bin/sbt

Tips and Notes

If you have any trouble running sbt, see Setup Notes on terminal encodings, HTTP proxies, and JVM options.

To install sbt, you could also use this fairly elaborated shell script: https://github.com/paulp/sbt-extras (see sbt file int the root dir). It has the same purpose as the simple shell script above but it will install sbt if necessary. It knows all recent versions of sbt and it also comes with a lot of useful command line options.

Next

Move on to create a simple project.

Clone this wiki locally