Since a while ago, the fine folks at Travis CI offer OS X builds.
Those machines also have Java installed, but just one version (1.7.0_45
at time of writing).
The usual jdk_switcher
mechanism is unavailable.
Futhermore, Scala is not available.
Luckily, it is possible to define a cross-platform (Linux and OS X) build within these constraints.
- Include @paulp's
sbt
launcher into the root of your repository. You can obtain a copy here. Alternatively, you can add aninstall
step to your.travis.yml
which fetches it before the build. (See the instructions in theREADME
ofsbt-extras
.) - Set the
language
entry in your.travis.yml
tojava
. - Remove the
jdk
and thescala
entries. - Instead, add a new top-level entry
env
which contains an itemSCALA_VERSION=2.11.7
for each Scala version you want to test on. - Add a new top-level entry
os
with the single itemosx
. It is important that it only containsosx
and notlinux
. - Add a new top-level entry
matrix
with sub-entryinclude
. See the example file in this Gist for an idea what it should look like.
For details on what exactly is available on the OS X boxes, see the official documentation.