Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.86 KB

README.md

File metadata and controls

64 lines (47 loc) · 1.86 KB

Intro Scala

SBT Commands

Enter SBT interactive shell

$ sbt

Common useful operations:

  • projects: List all projects and mark the current one
  • project <NAME>: Switch the current project to
  • clean: Deletes all generated files from compilation
  • compile: Compiles the main sources (in src/main/scala) of the current project
  • console: Open the REPL with the current project loaded
  • run: Run the main (in src/main/scala) of the current project
  • test: Compiles (main and test sources) and runs all tests
  • testOnly: Compiles (main and test sources) and runs matching tests
  • scalafmtAll: Format code for all configurations and projects

Run multiple commands:

>;clean;compile;test

Prepend ~ to any command to run it in watch mode. It can be used with one command:

>~test

or with many commands:

>~;scalafmtAll;clean;test

SBT Aliases

From the SBT interactive shell:

  • c: Compiles the main sources (in src/main/scala) of the current project
  • cc: Clean and compiles the main sources (in src/main/scala) of the current project
  • cn: Open the REPL with the current project loaded
  • r: Run the main (in src/main/scala) of the current project
  • t: Compiles (main and test sources) and runs all tests
  • to: Compiles (main and test sources) and runs matching tests
  • fm: Format code for all configurations and projects

Documentation

Useful documentations: