How to create a Scala 3 (Dotty) project with SBT

I can never remember how to create a Scala 3 (Dotty) project with SBT (in early 2019), so:

# create a new Dotty project
sbt new lampepfl/dotty.g8

# create a dotty project that cross compiles with scala 2
sbt new lampepfl/dotty-cross.g8

# start a dotty reply from within your sbt project
$ sbt

> console
scala> _

Here’s what an example interaction looks like — include SBT renaming my directory name to all lowercase, which brings me no joy:

/Users/al> sbt new lampepfl/dotty.g8
[info] Loading settings for project global-plugins from idea.sbt,plugins.sbt,metals.sbt ...
[info] Loading global plugins from /Users/al/.sbt/1.0/plugins
[info] Updating ProjectRef(uri("file:/Users/al/.sbt/1.0/plugins/"), "global-plugins")...
[info] Done updating.

A template to demonstrate a minimal Dotty application

name [Dotty Project Template]: MyCoolDottyProject

Template applied in /Users/al/mycooldottyproject

/Users/al> mv mycooldottyproject MyCoolDottyProject

For more information:

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.