This guide covers configuring Scala projects on Semaphore. If you’re new to Semaphore, we recommend reading the guided tour first.

Hello world#

The following Semaphore configuration file compiles and executes a Scala program:

# .semaphore/semaphore.yml

version: v1.0
name: Using Scala in Semaphore
    type: e1-standard-2
    os_image: ubuntu2004
  - name: Choose version
      - name: Choose Scala version
          - checkout
          - sem-version scala 2.12
          - scala hello.scala

The contents of the Scala program are as follows:

// hello.scala

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

Scala Play example project#

Semaphore provides a tutorial and demo Play application with a working CI pipeline that you can use to get started quickly. You can find them here:

Supported Scala versions#

For supported Scala versions check:

Changing the Scala version#

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

Choosing Scala version 2.12 can be done with 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.

See Also#