travis-ci/travis-cookbooks — pull request #107 by gildegoma (2012-11-21 23:04:20+00:00)
Title: Use sbt-extras, instead of orginal sbt

I propose here to switch from 'legacy sbt launcher script' to **sbt-extras** variant, which is largely adopted in scala community (even Typesafe forked sbt-extras and package it in its official stack).

## Pros

* `sbt-extras` options are **fully backward-compatible** with genuine `sbt` command.
* Take advantages of sbt magic, like **sbt version auto-detection** or **multiple sbt auto-installation**.
* **Very easy to deploy and maintain** (no more need for custom .deb package when upgrading to new versions of sbt.)
* With option `-batch` the sbt run is warrantied to always exit (instead falling in a user interactive prompt). This way no more travis build will get blocked until timeout expiration.
* JVM Memory parameters are easy to be tuned (easier to fix potential issues like #24 or #68)
* It should thus not need big effort to resolve #69.
* Scala users want it, or even already use sbt-extras in their Travis builds. Examples:
* https://groups.google.com/forum/?fromgroups=#!searchin/travis-ci/sbt/travis-ci/UH6ihitP4hA/rHmWQwS0GfkJ
* https://github.com/novus/salat/blob/master/scripts/travis.sh

## Cons

* Mmmh... sincerly none, and that's why I open this pull request.
* Of course we always should except to potentially suffer from a bug in sbt-extras, but it would usually be fixed by github community in a reasonable time.
* Check https://github.com/paulp/sbt-extras/issues

## Customization for Travis CI

* see details in separated commit a0a2520025ead48a605ad1a0502d8d928e847f82
* **ATTENTION**: Please double check that JVM settings in `jvmopts` template match with Worker VM specs! I copied these settings from https://github.com/michaelklishin/travisci-sbt-packaging/blob/master/src/sbt

## Examples

### Project configured for sbt 0.12.1 (already installed on the machine)

```
travis:~/project1$ sbt test
Detected sbt version 0.12.1
Using /home/travis/.sbt/0.12.1 as sbt dir, -sbt-dir to override.
[info] Loading project definition from ...
```

### Project configured for sbt 0.11.1 (not yet installed on the machine)

```
travis:~/project2$ sbt test
Detected sbt version 0.11.1
Downloading sbt launcher 0.11.1:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.1/sbt-launch.jar
To /opt/sbt-extras/.lib/0.11.1/sbt-launch.jar
Using /home/vagrant/.sbt/0.11.1 as sbt dir, -sbt-dir to override.
Getting net.java.dev.jna jna 3.2.3 ...
downloading http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.2.3/jna-3.2.3.jar ...
[SUCCESSFUL ] net.java.dev.jna#jna;3.2.3!jna.jar (1650ms)
:: retrieving :: org.scala-tools.sbt#boot-app
confs: [default]
1 artifacts copied, 0 already retrieved (838kB/71ms)
Getting Scala 2.9.1 (for sbt)...
```