Building a Scala project
What This Guide Covers
Scala builds are not available on the OS X environment.
Projects using sbt
If your project has
project directory or
build.sbt file in the repository root, the Travis CI Scala builder will use
sbt to build it.
Thanks to paulp/sbt-extras the sbt version of your project is dynamically detected and used.
Choosing Scala versions to test against
Thanks to sbt ability to perform actions against multiple Scala versions, it is possible to test your projects against different Scala versions. To specify Scala versions you want your project to be tested against, use the
scala key, for example:
language: scala scala: - 2.9.3 - 2.10.4 - 2.11.2
Default Test Command
By default, Travis CI will use
sbt ++$TRAVIS_SCALA_VERSION test
to run your test suite. This can be overridden as described in the general build configuration guide.
Because Travis CI Scala builder assumes sbt dependency management is used by default, it automatically will pull down project dependencies before running tests without any effort on your side.
Custom sbt Arguments
If needed, you can override SBT and JVM options in many different ways by passing extra arguments to
script: - sbt -jvm-opts travis/jvmopts.compile ... compile - sbt -jvm-opts travis/jvmopts.test ... test
will then run
test with different JVM parameters.
sbt_args key in your
.travis.yml, you also can specify extra arguments to be passed to the default build script.
sbt_args: -no-colors -J-Xss2m
script: sbt -no-colors -J-Xss2m ++$TRAVIS_SCALA_VERSION test
Projects Using Gradle, Maven or Ant
If your project is not configured for sbt, the build process behaves like a typical Java Project.
Testing Against Multiple JDKs
As for any JVM language, it is also possible to test against multiple JDKs.
For Scala projects,
jdk can be given as arrays
to construct a build matrix.
The version of Scala a job is using is available as: