Scala #0 | Setup


Introduction

  • Install

  • Components (commands)

    • scalac : the scala compiler

    • scala : the scala REPL and script runner

    • scala-cli: scala CLI, interactive toolkit for scala

    • sbt: build tool

    • amm : Ammonite, an enhanced REPL

    • scalafmt : the scala code formatter



Scalac (Scala Compiler)

  • usage

    • scalac HelloWorld.scala


SBT (Simple Build Kit)

  • Directory Structure : sbt Reference Manual — Directory structure

    • (1) Base Directory: location of build.sbt, ${PROJECT_HOME}

    • (2) Source code : Locate your source into${PROJECT_HOME}/src/main/scala

    • (3) Build support files : ${PROJECT_HOME}/project/

${PROJECT_HOME}
├── build.sbt
├── project
│    ├── build.properties
│    └── plugins.sbt
└── src
     └── main
           └── scala
  • Usuage

    • build (sbt package|sbt assembly)

      • Exception 1) is already defined as object => same object in directory (check .ipynb_checkpoint)


Scala

  • usage

    • scala --classpath . HelloWorld


References