Skip to content

Instantly share code, notes, and snippets.

@witt3rd
Last active April 18, 2021 14:08
Show Gist options
  • Select an option

  • Save witt3rd/e0aa245bcce6c2f0e4a16d4a504e6fa9 to your computer and use it in GitHub Desktop.

Select an option

Save witt3rd/e0aa245bcce6c2f0e4a16d4a504e6fa9 to your computer and use it in GitHub Desktop.
Scala installation, setup, and usage notes

Scala

Install

Installers

These CLI utilities are used to fetch things we need.

Java

We need a JDK, which SDKMAN is used for.

# List available JDKs
sdk ls java

Amazon seems to have a high-quality one.

Version 11 is the last LTS version.

sdk i java 11.0.10.9.1-amzn

Build

sbt

sdk i sbt 1.5.0

Bloop

A system-wide build server that speeds compile times and can watch for changes and automatically recompile.

cs install bloop --only-prebuilt=true

New Project

Create a new Scala 3 project using the following template:

sbt new scala/scala3.g8

Change into your project directory and compile and run it using sbt.

sbt compile
sbt run

IDEs

VS Code

This extension will install everything it needs

Watch, Compile, and Run

Use Bloop to watch for changes and automatically compile and run your program. Your project should have a .bloop directory that contains a <project>.json, <project>-test.json, and a <project> subdirectory. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use bloop project to create one.

In one terminal session from within your project's root directory (the one that contains .bloop), run:

bloop compile -w <project>

From another terminal (same directory), run:

bloop run -w <project>

Language

Ecosystem

ZIO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment