Scala 3 for Scala 2 Developers

This is the repository for the class Scala 3 for Scala 2 Developers, containing teaching material and workshop exercises.

Downloading

To download this repository onto your machine, make sure you have Git installed.

Then open a terminal, change the directory to wherever you want to store the files contained in this repository, and then enter the following command:

git clone git@github.com:jdegoes/scala3-for-scala2-developers.git .

Note that if you haven't configured SSH, you may have to use the HTTP protocol to perform the download, which can be done as follows:

git clone https://github.com/jdegoes/scala3-for-scala2-developers.git .

Building

The project contains an SBT build file. SBT is the most common Scala build tool. You can download the build tool here.

SBT build files can be imported into IntelliJ IDEA, an IDE that has a plugin for developing Scala applications.

Alternately, some people use Visual Studio Code to develop Scala applications. If you choose to use Visual Studio Code, then make sure you install the Metals plugin and the Scala Syntax plugin.

Even if not using IntelliJ IDEA or Visual Studio Code with Metals, you can build the project from any terminal by using SBT directly.

After opening a terminal and changing the directory to wherever you downloaded the files, simply enter the following command:

sbt

This will start SBT in interactive mode, where you can type commands into the console in order to compile, run, and test your SBT project.

To compile the code in the project, type the following command at the SBT prompt:

compile

If there are any compiler errors, they will be reported to you, and you can edit the source code to fix the compiler errors and try again.

Alternately, you can put SBT into continuous compilation mode. In this mode, SBT will attempt to compile your project whenever any files change state.

To place SBT into this mode, type the following command at the SBT prompt:

~ compile

Legal

Copyright (C) 2020 John A. De Goes. All rights reserved.