title | sidebar_position |
---|---|
Command-line options |
1 |
This document describes as scala-cli behaves if run as scala
command. See more information in SIP-46
This is a summary of options that are available for each subcommand of the scala-cli
command.
All options that start with:
-g
-language
-opt
-P
-target
-V
-W
-X
-Y
are assumed to be Scala compiler options and will be propagated to Scala Compiler. This applies to all commands that uses compiler directly or indirectly.
Scalac options that are directly supported in scala CLI (so can be provided as is, without any prefixes etc.):
-encoding
-release
-color
-nowarn
-feature
-deprecation
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
IMPLEMENTATION specific
per Scala Runner specification
Protocol to use to open a BSP connection with Bloop
IMPLEMENTATION specific
per Scala Runner specification
Socket file to use to open a BSP connection with Bloop
IMPLEMENTATION specific
per Scala Runner specification
Host the compilation server should bind to
IMPLEMENTATION specific
per Scala Runner specification
Port the compilation server should bind to (pass -1
to pick a random port)
IMPLEMENTATION specific
per Scala Runner specification
Daemon directory of the Bloop daemon (directory with lock, pid, and socket files)
IMPLEMENTATION specific
per Scala Runner specification
If Bloop isn't already running, the version we should start
IMPLEMENTATION specific
per Scala Runner specification
Maximum duration to wait for the BSP connection to be opened
IMPLEMENTATION specific
per Scala Runner specification
Duration between checks of the BSP connection state
IMPLEMENTATION specific
per Scala Runner specification
Maximum duration to wait for the compilation server to start up
IMPLEMENTATION specific
per Scala Runner specification
Include default JVM options for Bloop
IMPLEMENTATION specific
per Scala Runner specification
Pass java options to use by Bloop server
IMPLEMENTATION specific
per Scala Runner specification
Bloop global options file
IMPLEMENTATION specific
per Scala Runner specification
JVM to use to start Bloop (e.g. 'system|11', 'temurin:17', …)
IMPLEMENTATION specific
per Scala Runner specification
Working directory for Bloop, if it needs to be started
IMPLEMENTATION specific
per Scala Runner specification
Enable / disable usage of Bloop compilation server. Bloop is used by default so use --server=false
to disable it. Disabling compilation server allows to test compilation in more controlled mannter (no caching or incremental compiler) but has a detrimental effect of performance.
Available in commands:
Aliases: -p
, --print-classpath
SHOULD have
per Scala Runner specification
Print the resulting class path
SHOULD have
per Scala Runner specification
Compile test scope
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Dump config DB as JSON
Aliases: --remove
SHOULD have
per Scala Runner specification
Remove an entry from config
Aliases: -f
SHOULD have
per Scala Runner specification
Force overwriting values for key
Available in commands:
bsp
, compile
, config
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
SHOULD have
per Scala Runner specification
Turn debugging on
SHOULD have
per Scala Runner specification
Debug port (5005 by default)
SHOULD have
per Scala Runner specification
Debug mode (attach by default)
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
Aliases: --dep
MUST have
per Scala Runner specification
Add dependencies
Aliases: --compile-dep
, --compile-lib
MUST have
per Scala Runner specification
Add compile-only dependencies
Aliases: -r
, --repo
SHOULD have
per Scala Runner specification
Add repositories for dependency resolution.
Accepts predefined repositories supported by Coursier (like sonatype:snapshots
or m2Local
) or a URL of the root of Maven repository
Aliases: -P
, --plugin
MUST have
per Scala Runner specification
Add compiler plugin dependencies
Available in commands:
Aliases: -o
MUST have
per Scala Runner specification
Set the destination path
Aliases: -f
MUST have
per Scala Runner specification
Overwrite the destination directory, if it exists
Aliases: --default-scaladoc-opts
SHOULD have
per Scala Runner specification
Control if Scala CLI should use default options for scaladoc, true by default. Use --default-scaladoc-opts:false
to not include default options.
Available in commands:
SHOULD have
per Scala Runner specification
Check if sources are well formatted
IMPLEMENTATION specific
per Scala Runner specification
Use project filters defined in the configuration. Turned on by default, use --respect-project-filters:false
to disable it.
IMPLEMENTATION specific
per Scala Runner specification
Saves .scalafmt.conf file if it was created or overwritten
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
Aliases: -F
IMPLEMENTATION specific
per Scala Runner specification
Pass an argument to scalafmt.
Aliases: --scalafmt-config
IMPLEMENTATION specific
per Scala Runner specification
Custom path to the scalafmt configuration file.
Aliases: --scalafmt-conf-snippet
, --scalafmt-config-str
IMPLEMENTATION specific
per Scala Runner specification
Pass configuration as a string.
Aliases: --dialect
IMPLEMENTATION specific
per Scala Runner specification
Pass a global dialect for scalafmt. This overrides whatever value is configured in the .scalafmt.conf file or inferred based on Scala version used.
Aliases: --fmt-version
IMPLEMENTATION specific
per Scala Runner specification
Pass scalafmt version before running it (3.7.12 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.
Available in commands:
bsp
, clean
, compile
, config
, doc
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
Aliases: --suppress-experimental-warning
IMPLEMENTATION specific
per Scala Runner specification
Suppress warnings about using experimental features
Available in commands:
bsp
, clean
, compile
, config
, doc
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
IMPLEMENTATION specific
per Scala Runner specification
Print usage and exit
Aliases: -h
, -help
IMPLEMENTATION specific
per Scala Runner specification
Print help message and exit
Aliases: --full-help
, -full-help
, -help-full
IMPLEMENTATION specific
per Scala Runner specification
Print help message, including hidden options, and exit
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
IMPLEMENTATION specific
per Scala Runner specification
Show options for ScalaJS
IMPLEMENTATION specific
per Scala Runner specification
Show options for ScalaNative
Aliases: --doc-help
, --help-doc
, --scaladoc-help
IMPLEMENTATION specific
per Scala Runner specification
Show options for Scaladoc
Aliases: --repl-help
IMPLEMENTATION specific
per Scala Runner specification
Show options for Scala REPL
Aliases: --fmt-help
, --help-fmt
, --scalafmt-help
IMPLEMENTATION specific
per Scala Runner specification
Show options for Scalafmt
Available in commands:
install completions
, install-completions
Aliases: --shell
IMPLEMENTATION specific
per Scala Runner specification
Name of the shell, either zsh or bash
IMPLEMENTATION specific
per Scala Runner specification
Path to *rc
file, defaults to .bashrc
or .zshrc
depending on shell
Aliases: -o
IMPLEMENTATION specific
per Scala Runner specification
Completions output directory
IMPLEMENTATION specific
per Scala Runner specification
Custom banner in comment placed in rc file
IMPLEMENTATION specific
per Scala Runner specification
Custom completions name
IMPLEMENTATION specific
per Scala Runner specification
Print completions to stdout
Available in commands:
repl
, console
, run
, shebang
, test
Aliases: -J
MUST have
per Scala Runner specification
Set Java options, such as -Xmx1g
Available in commands:
repl
, console
, run
, shebang
, test
Aliases: --java-prop
IMPLEMENTATION specific
per Scala Runner specification
Add java properties. Note that options equal -Dproperty=value
are assumed to be java properties and don't require to be passed after --java-prop
.
Available in commands:
bsp
, compile
, config
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
SHOULD have
per Scala Runner specification
Set the Java home directory
Aliases: -j
SHOULD have
per Scala Runner specification
Use a specific JVM, such as 14
, adopt:11
, or graalvm:21
, or system
IMPLEMENTATION specific
per Scala Runner specification
JVM index URL
IMPLEMENTATION specific
per Scala Runner specification
Operating system to use when looking up in the JVM index
IMPLEMENTATION specific
per Scala Runner specification
CPU architecture to use when looking up in the JVM index
SHOULD have
per Scala Runner specification
Javac plugin dependencies or files
Aliases: --javac-opt
SHOULD have
per Scala Runner specification
Javac options
IMPLEMENTATION specific
per Scala Runner specification
Port for BSP debugging
Available in commands:
bsp
, clean
, compile
, config
, doc
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
Aliases: -q
IMPLEMENTATION specific
per Scala Runner specification
Decrease logging verbosity
IMPLEMENTATION specific
per Scala Runner specification
Use progress bars
Available in commands:
Aliases: -M
MUST have
per Scala Runner specification
Specify which main class to run
Aliases: --list-main-class
, --list-main-classes
, --main-class-list
SHOULD have
per Scala Runner specification
List main classes available in the current context
Available in commands:
SHOULD have
per Scala Runner specification
Print the command that would have been run (one argument per line), rather than running it
IMPLEMENTATION specific
per Scala Runner specification
Temporary / working directory where to write generated launchers
IMPLEMENTATION specific
per Scala Runner specification
Run Java commands using a manifest-based class path (shortens command length)
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
SHOULD have
per Scala Runner specification
Enable Scala.js. To show more options for Scala.js pass --help-js
SHOULD have
per Scala Runner specification
The Scala.js version (1.13.2 by default).
SHOULD have
per Scala Runner specification
The Scala.js mode, either dev
or release
SHOULD have
per Scala Runner specification
The Scala.js module kind: commonjs/common, esmodule/es, nomodule/none
SHOULD have
per Scala Runner specification
SHOULD have
per Scala Runner specification
Emit source maps
SHOULD have
per Scala Runner specification
Set the destination path of source maps
SHOULD have
per Scala Runner specification
Enable jsdom
SHOULD have
per Scala Runner specification
A header that will be added at the top of generated .js files
IMPLEMENTATION specific
per Scala Runner specification
Primitive Longs may be compiled as primitive JavaScript bigints
IMPLEMENTATION specific
per Scala Runner specification
Avoid class'es when using functions and prototypes has the same observable semantics.
IMPLEMENTATION specific
per Scala Runner specification
Avoid lets and consts when using vars has the same observable semantics.
IMPLEMENTATION specific
per Scala Runner specification
The Scala.js module split style: fewestmodules, smallestmodules, smallmodulesfor
IMPLEMENTATION specific
per Scala Runner specification
Create as many small modules as possible for the classes in the passed packages and their subpackages.
SHOULD have
per Scala Runner specification
The Scala.js ECMA Script version: es5_1, es2015, es2016, es2017, es2018, es2019, es2020, es2021
IMPLEMENTATION specific
per Scala Runner specification
Path to the Scala.js linker
IMPLEMENTATION specific
per Scala Runner specification
Scala.js CLI version to use for linking (1.13.2 by default).
IMPLEMENTATION specific
per Scala Runner specification
Scala.js CLI Java options
IMPLEMENTATION specific
per Scala Runner specification
Whether to run the Scala.js CLI on the JVM or using a native executable
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
SHOULD have
per Scala Runner specification
Enable Scala Native. To show more options for Scala Native pass --help-native
SHOULD have
per Scala Runner specification
Set the Scala Native version (0.4.14 by default).
SHOULD have
per Scala Runner specification
Set Scala Native compilation mode
SHOULD have
per Scala Runner specification
Link-time optimisation mode
SHOULD have
per Scala Runner specification
Set the Scala Native garbage collector
IMPLEMENTATION specific
per Scala Runner specification
Path to the Clang command
IMPLEMENTATION specific
per Scala Runner specification
Path to the Clang++ command
SHOULD have
per Scala Runner specification
Extra options passed to clang
verbatim during linking
IMPLEMENTATION specific
per Scala Runner specification
Use default linking settings
SHOULD have
per Scala Runner specification
List of compile options
IMPLEMENTATION specific
per Scala Runner specification
Use default compile options
SHOULD have
per Scala Runner specification
Embed resources into the Scala Native binary (can be read with the Java resources API)
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
Aliases: -O
, --scala-opt
, --scala-option
IMPLEMENTATION specific
per Scala Runner specification
Add a scalac
option. Note that options starting with -g
, -language
, -opt
, -P
, -target
, -V
, -W
, -X
, and -Y
are assumed to be Scala compiler options and don't require to be passed after -O
or --scalac-option
.
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
Aliases: --help-scalac
IMPLEMENTATION specific
per Scala Runner specification
Show help for scalac. This is an alias for --scalac-option -help
Aliases: --verbose-scalac
IMPLEMENTATION specific
per Scala Runner specification
Turn verbosity on for scalac. This is an alias for --scalac-option -verbose
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
Aliases: -S
, --scala
MUST have
per Scala Runner specification
Set the Scala version (3.3.0 by default)
Aliases: -B
, --scala-bin
, --scala-binary
MUST have
per Scala Runner specification
Set the Scala binary version
Aliases: --class
, --class-path
, --classes
, -classpath
, --classpath
, -cp
, --extra-class
, --extra-class-path
, --extra-classes
, --extra-jar
, --jar
, --jars
MUST have
per Scala Runner specification
Add extra JARs and compiled classes to the class path
Aliases: --compile-only-jar
, --compile-only-jars
, --extra-compile-only-jar
SHOULD have
per Scala Runner specification
Add extra JARs in the compilaion class path. Mainly using to run code in managed environments like Spark not to include certain depenencies on runtime ClassPath.
Aliases: --extra-source-jar
, --source-jar
, --source-jars
SHOULD have
per Scala Runner specification
Add extra source JARs
Aliases: --resource-dir
MUST have
per Scala Runner specification
Add a resource directory
SHOULD have
per Scala Runner specification
Specify platform
IMPLEMENTATION specific
per Scala Runner specification
Aliases: -with-compiler
, --with-scala-compiler
MUST have
per Scala Runner specification
Allows to include the Scala compiler artifacts on the classpath.
IMPLEMENTATION specific
per Scala Runner specification
Do not add dependency to Scala Standard library. This is useful, when Scala CLI works with pure Java projects.
IMPLEMENTATION specific
per Scala Runner specification
Should include Scala CLI runner on the runtime ClassPath. Runner is added by default for application running on JVM using standard Scala versions. Runner is used to make stack traces more readable in case of application failure.
SHOULD have
per Scala Runner specification
Generate SemanticDBs
IMPLEMENTATION specific
per Scala Runner specification
Aliases: --compile-out
, --compile-output
, -d
, --destination
, --output-directory
MUST have
per Scala Runner specification
Copy compilation results to output directory using either relative or absolute path
Aliases: --toolkit
IMPLEMENTATION specific
per Scala Runner specification
Add toolkit to classPath
IMPLEMENTATION specific
per Scala Runner specification
Exclude sources
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
SHOULD have
per Scala Runner specification
Allows to execute a passed string as a Scala script
Aliases: -e
, --execute-sc
, --execute-scala-script
SHOULD have
per Scala Runner specification
A synonym to --script-snippet, which defaults the sub-command to run
when no sub-command is passed explicitly
SHOULD have
per Scala Runner specification
Allows to execute a passed string as Scala code
IMPLEMENTATION specific
per Scala Runner specification
A synonym to --scala-snippet, which defaults the sub-command to run
when no sub-command is passed explicitly
IMPLEMENTATION specific
per Scala Runner specification
Allows to execute a passed string as Java code
IMPLEMENTATION specific
per Scala Runner specification
A synonym to --scala-snippet, which defaults the sub-command to run
when no sub-command is passed explicitly
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
Aliases: --suppress-warning-directives-in-multiple-files
IMPLEMENTATION specific
per Scala Runner specification
Suppress warnings about using directives in multiple files
IMPLEMENTATION specific
per Scala Runner specification
Suppress warnings about outdated dependencies in project
Available in commands:
SHOULD have
per Scala Runner specification
Name of the test framework's runner class to use while running tests
SHOULD have
per Scala Runner specification
Fail if no test suites were run
SHOULD have
per Scala Runner specification
Specify a glob pattern to filter the tests suite to be run.
Available in commands:
Aliases: -f
IMPLEMENTATION specific
per Scala Runner specification
Force scala-cli uninstall
IMPLEMENTATION specific
per Scala Runner specification
Don't clear Scala CLI cache
IMPLEMENTATION specific
per Scala Runner specification
Binary name
IMPLEMENTATION specific
per Scala Runner specification
Binary directory
Available in commands:
uninstall
, uninstall completions
, uninstall-completions
IMPLEMENTATION specific
per Scala Runner specification
Path to *rc
file, defaults to .bashrc
or .zshrc
depending on shell
IMPLEMENTATION specific
per Scala Runner specification
Custom banner in comment placed in rc file
IMPLEMENTATION specific
per Scala Runner specification
Custom completions name
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Binary name
IMPLEMENTATION specific
per Scala Runner specification
Binary directory
Aliases: -f
IMPLEMENTATION specific
per Scala Runner specification
Force update Scala CLI if it is outdated
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
A github token used to access GitHub. Not needed in most cases.
Available in commands:
bsp
, clean
, compile
, config
, doc
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
Aliases: -v
, -verbose
IMPLEMENTATION specific
per Scala Runner specification
Increase verbosity (can be specified multiple times)
Aliases: -i
IMPLEMENTATION specific
per Scala Runner specification
Interactive mode
IMPLEMENTATION specific
per Scala Runner specification
Enable actionable diagnostics
Available in commands:
Aliases: --cli
IMPLEMENTATION specific
per Scala Runner specification
Show plain Scala CLI version only
Aliases: --scala
IMPLEMENTATION specific
per Scala Runner specification
Show plain Scala version only
IMPLEMENTATION specific
per Scala Runner specification
A github token used to access GitHub. Not needed in most cases.
IMPLEMENTATION specific
per Scala Runner specification
Don't check for the newest available Scala CLI version upstream
Available in commands:
compile
, repl
, console
, run
, shebang
, test
Aliases: -w
SHOULD have
per Scala Runner specification
Run the application in the background, automatically wake the thread and re-run if sources have been changed
Aliases: --revolver
SHOULD have
per Scala Runner specification
Run the application in the background, automatically kill the process and restart if sources have been changed
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Command-line options JSON file
Available in commands:
Aliases: --bsp-dir
IMPLEMENTATION specific
per Scala Runner specification
Custom BSP configuration location
Aliases: --name
IMPLEMENTATION specific
per Scala Runner specification
Name of BSP
Available in commands:
bsp
, compile
, config
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
IMPLEMENTATION specific
per Scala Runner specification
Specify a TTL for changing dependencies, such as snapshots
IMPLEMENTATION specific
per Scala Runner specification
Set the coursier cache location
IMPLEMENTATION specific
per Scala Runner specification
Enable checksum validation of artifacts downloaded by coursier
Available in commands:
bsp
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
IMPLEMENTATION specific
per Scala Runner specification
IMPLEMENTATION specific
per Scala Runner specification
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Aliases: -f
IMPLEMENTATION specific
per Scala Runner specification
Overwrite if it exists
IMPLEMENTATION specific
per Scala Runner specification
Binary name
IMPLEMENTATION specific
per Scala Runner specification
Print the update to env
variable
IMPLEMENTATION specific
per Scala Runner specification
Binary directory
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Don't actually run the REPL, just fetch it
Available in commands:
IMPLEMENTATION specific
per Scala Runner specification
Available in commands:
bsp
, clean
, compile
, doc
, fmt
, format
, scalafmt
, repl
, console
, run
, setup-ide
, shebang
, test
IMPLEMENTATION specific
per Scala Runner specification
Directory where .scala-build is written