Supported Scala versions

The supported Scala versions are:

  • 2.11.11
  • 2.12.6

Changing Scala version

You can choose the Scala version to use with the help of the sem-version utility.

Choosing Scala version 2.11 can be done with the following command:

sem-version scala 2.11

In order to go back to Scala 2.12, which is the default version of the Semaphore Virtual Machine, you should execute the following command:

sem-version scala 2.12

Dependency management

You can use Semaphore's cache tool to store and load any files or Scala libraries that you want to reuse between jobs.

System dependencies

Scala projects might need packages like database drivers. As you have full sudo access on each Semaphore 2.0 VM, you are free to install all required packages.

A sample Scala project

The following .semaphore/semaphore.yml file compiles and executes an Scala source file using two different versions of the Scala compiler:

version: v1.0
name: Using Scala in Semaphore 2.0
    type: e1-standard-2
    os_image: ubuntu1804

  - name: Choose version
      - name: Choose Scala version
          - checkout
          - scala -version
          - sem-version scala 2.11
          - scala -version
          - sem-version scala 2.12
          - scala -version

  - name: Compile Scala code
      - name: Run Scala code with 2.11
          - checkout
          - sem-version scala 2.11
          - scala hw.scala

The contents of hw.scala are as follows:

object HW {
    def main(args: Array[String]) {
      println("Hello World!")

See Also

Still need help? Contact Us Contact Us