Scala 3

Scala 3 setup

Jacob Xie published on
2 min, 214 words

Categories: Doc

Tags: Scala

Scala 3

  • JDK 11

    sudo apt-get install openjdk-11-jdk

    make sure $JAVA_HOME is set in ~/.bashrc:

    export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
  • SBT

    echo "deb all main" | sudo tee /etc/apt/sources.list.d/sbt.list
    echo "deb /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
    curl -sL "" | sudo apt-key add
    sudo apt-get update
    sudo apt-get install sbt
  • (Optional) Set sbt mirror

    create repositories (huawei mirror) under ~/.sbt/:

    sbt-plugin-repo:, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  • (Optional) Set global repo for all projects (rather than each project holds its own repo)

    cd /etc/sbt

    then sudo vim sbtopts add one line at the bottom:
  • Check everything, first by executing sbt and enter to sbt shell

    check sbt version:


    check global repo if override:

    show overrideBuildResolvers

    show resolvers:

    show fullResolvers
  • Create a new scala3 project

    sbt new scala/scala3.g8
  • (Optional) vs-code extension Metals, again please make sure that $JAVA_HOME is set.