Command-line options
This is a summary of options that are available for each subcommand of the scala-cli
command.
Scalac options forwarding
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
-indent
-no-indent
-unchecked
-rewrite
-old-syntax
-new-syntax
Benchmarking options
Available in commands:
bsp
, compile
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, publish
, publish local
, repl
, console
, run
, setup-ide
, shebang
, test
--jmh
Run JMH benchmarks
--jmh-version
Set JMH version (default: 1.37)
Compilation server options
Available in commands:
bloop
, bloop exit
, bloop output
, bloop start
, bsp
, compile
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, publish
, publish local
, repl
, console
, run
, setup-ide
, shebang
, test
, uninstall
--bloop-bsp-protocol
[Internal] Protocol to use to open a BSP connection with Bloop
--bloop-bsp-socket
[Internal] Socket file to use to open a BSP connection with Bloop
--bloop-host
[Internal] Host the compilation server should bind to
--bloop-port
[Internal]
Port the compilation server should bind to (pass -1
to pick a random port)
--bloop-daemon-dir
[Internal] Daemon directory of the Bloop daemon (directory with lock, pid, and socket files)
--bloop-version
[Internal] If Bloop isn't already running, the version we should start
--bloop-bsp-timeout
[Internal] Maximum duration to wait for the BSP connection to be opened
--bloop-bsp-check-period
[Internal] Duration between checks of the BSP connection state
--bloop-startup-timeout
[Internal] Maximum duration to wait for the compilation server to start up
--bloop-default-java-opts
[Internal] Include default JVM options for Bloop
--bloop-java-opt
[Internal] Pass java options to use by Bloop server
--bloop-global-options-file
[Internal] Bloop global options file
--bloop-jvm
[Internal] JVM to use to start Bloop (e.g. 'system|17', 'temurin:21', …)
--bloop-working-dir
[Internal] Working directory for Bloop, if it needs to be started
--server
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.
Compile options
Available in commands:
--print-class-path
Aliases: -p
, --print-classpath
Print the resulting class path
Config options
Available in commands:
--dump
[Internal] Dump config DB as JSON
--create-pgp-key
Create PGP keychain in config
--pgp-password
Aliases: --passphrase
A password used to encode the private PGP keychain
--email
Email used to create the PGP keychains in config
--password-value
When accessing config's content print the password value rather than how to get the password When saving an entry in config save the password value rather than how to get the password e.g. print/save the value of environment variable ENV_VAR rather than "env:ENV_VAR"
--unset
Aliases: --remove
Remove an entry from config
--https-only
For repository.credentials and publish.credentials, whether these credentials should be HTTPS only (default: true)
--match-host
For repository.credentials, whether to use these credentials automatically based on the host
--optional
For repository.credentials, whether to use these credentials are optional
--pass-on-redirect
For repository.credentials, whether to use these credentials should be passed upon redirection
--force
Aliases: -f
Force overwriting values for key
Coursier options
Available in commands:
bloop
, bloop exit
, bloop start
, bsp
, compile
, config
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, pgp push
, publish
, publish local
, publish setup
, repl
, console
, run
, github secret create
, gh secret create
, setup-ide
, shebang
, test
, uninstall
--ttl
[Internal] Specify a TTL for changing dependencies, such as snapshots
--cache
[Internal] Set the coursier cache location
--coursier-validate-checksums
[Internal] Enable checksum validation of artifacts downloaded by coursier
--offline
Disable using the network to download artifacts, use the local cache only
Cross options
Available in commands:
compile
, package
, publish
, publish local
, repl
, console
, run
, shebang
, test
--cross
Run given command against all provided Scala versions and/or platforms
Debug options
Available in commands:
bloop
, bloop start
, bsp
, compile
, config
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, pgp push
, publish
, publish local
, publish setup
, repl
, console
, run
, setup-ide
, shebang
, test
--debug
Turn debugging on
--debug-port
Debug port (5005 by default)
--debug-mode
Debug mode (attach by default)
Dependency options
Available in commands:
bsp
, compile
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, publish
, publish local
, repl
, console
, run
, setup-ide
, shebang
, test
--dependency
Aliases: --dep
Add dependencies
--compile-only-dependency
Aliases: --compile-dep
, --compile-lib
Add compile-only dependencies
--repository
Aliases: -r
, --repo
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
--compiler-plugin
Aliases: -P
, --plugin
Add compiler plugin dependencies
Dependency update options
Available in commands:
--all
Update all dependencies if a newer version was released
Doc options
Available in commands:
--output
Aliases: -o
Set the destination path
--force
Aliases: -f
Overwrite the destination directory, if it exists
--default-scaladoc-options
Aliases: --default-scaladoc-opts
Control if Scala CLI should use default options for scaladoc, true by default. Use --default-scaladoc-opts:false
to not include default options.
Export options
Available in commands:
--sbt
Sets the export format to SBT
--maven
Aliases: --mvn
Sets the export format to Maven
--mill
Sets the export format to Mill
--json
Sets the export format to Json
--sbt-setting
Aliases: --setting
--project
Aliases: -p
Project name to be used on Mill build file
--sbt-version
Version of SBT to be used for the export
--mvn-version
Version of Maven Compiler Plugin to be used for the export
--mvn-scala-version
Version of Maven Scala Plugin to be used for the export
--mvn-exec-plugin-version
Version of Maven Exec Plugin to be used for the export
--mvn-app-artifact-id
ArtifactId to be used for the maven export
--mvn-app-group-id
GroupId to be used for the maven export
--mvn-app-version
Version to be used for the maven export
--output
Aliases: -o
Fmt options
Available in commands:
--check
Check if sources are well formatted
--respect-project-filters
Use project filters defined in the configuration. Turned on by default, use --respect-project-filters:false
to disable it.
--save-scalafmt-conf
Saves .scalafmt.conf file if it was created or overwritten
--os-arch-suffix
[Internal]
--scalafmt-tag
[Internal]
--scalafmt-github-org-name
[Internal]
--scalafmt-extension
[Internal]
--scalafmt-launcher
[Internal]
--scalafmt-arg
Aliases: -F
Pass an argument to scalafmt.
--scalafmt-conf
Aliases: --scalafmt-config
Custom path to the scalafmt configuration file.
--scalafmt-conf-str
Aliases: --scalafmt-conf-snippet
, --scalafmt-config-str
Pass configuration as a string.
--scalafmt-dialect
Aliases: --dialect
Pass a global dialect for scalafmt. This overrides whatever value is configured in the .scalafmt.conf file or inferred based on Scala version used.
--scalafmt-version
Aliases: --fmt-version
Pass scalafmt version before running it (3.8.3 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.
Global suppress warning options
Available in commands:
add-path
, bloop
, bloop exit
, bloop output
, bloop start
, bsp
, clean
, compile
, config
, default-file
, dependency-update
, directories
, doc
, export
, fix
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, new
, package
, pgp pull
, pgp push
, publish
, publish local
, publish setup
, repl
, console
, run
, github secret create
, gh secret create
, github secret list
, gh secret list
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
--suppress-experimental-feature-warning
Aliases: --suppress-experimental-warning
Suppress warnings about using experimental features
Help options
Available in commands:
add-path
, bloop
, bloop exit
, bloop output
, bloop start
, bsp
, clean
, compile
, config
, default-file
, dependency-update
, directories
, doc
, export
, fix
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, new
, package
, pgp create
, pgp key-id
, pgp pull
, pgp push
, pgp sign
, pgp verify
, publish
, publish local
, publish setup
, repl
, console
, run
, github secret create
, gh secret create
, github secret list
, gh secret list
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
--usage
Print usage and exit
--help
Aliases: -h
, -help
Print help message and exit
--help-full
Aliases: --full-help
, -full-help
, -help-full
Print help message, including hidden options, and exit
Help group options
Available in commands:
bsp
, compile
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, publish
, publish local
, repl
, console
, run
, setup-ide
, shebang
, test
--help-envs
Aliases: --env-help
, --envs-help
, --help-env
Show environment variable help
--help-js
Show options for ScalaJS
--help-native
Show options for ScalaNative
--help-scaladoc
Aliases: --doc-help
, --help-doc
, --scaladoc-help
Show options for Scaladoc
--help-repl
Aliases: --repl-help
Show options for Scala REPL
--help-scalafmt
Aliases: --fmt-help
, --help-fmt
, --scalafmt-help
Show options for Scalafmt
Install completions options
Available in commands:
install completions
, install-completions
--format
Aliases: --shell
Name of the shell, either zsh or bash
--rc-file
Path to *rc
file, defaults to .bashrc
or .zshrc
depending on shell
--output
Aliases: -o
Completions output directory
--banner
[Internal] Custom banner in comment placed in rc file
--name
[Internal] Custom completions name
--env
Print completions to stdout
Java options
Available in commands:
package
, repl
, console
, run
, shebang
, test
--java-opt
Aliases: -J
Set Java options, such as -Xmx1g
Java prop options
Available in commands:
package
, repl
, console
, run
, shebang
, test
--java-prop-option
Aliases: --java-prop
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
.
Jvm options
Available in commands:
bloop
, bloop start
, bsp
, compile
, config
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, pgp push
, publish
, publish local
, publish setup
, repl
, console
, run
, setup-ide
, shebang
, test
--java-home
Set the Java home directory
--jvm
Aliases: -j
Use a specific JVM, such as 14
, adopt:11
, or graalvm:21
, or system
. scala-cli uses coursier to fetch JVMs, so you can use cs java --available
to list the available JVMs.
--jvm-index
[Internal] JVM index URL
--jvm-index-os
[Internal] Operating system to use when looking up in the JVM index
--jvm-index-arch
[Internal] CPU architecture to use when looking up in the JVM index
--javac-plugin
[Internal] Javac plugin dependencies or files
--javac-option
Aliases: --javac-opt
[Internal] Javac options
--bsp-debug-port
[Internal] Port for BSP debugging
Logging options
Available in commands:
add-path
, bloop
, bloop exit
, bloop output
, bloop start
, bsp
, clean
, compile
, config
, default-file
, dependency-update
, directories
, doc
, export
, fix
, fmt
, format
, scalafmt
, help
, install completions
, install-completions
, install-home
, new
, package
, pgp pull
, pgp push
, publish
, publish local
, publish setup
, repl
, console
, run
, github secret create
, gh secret create
, github secret list
, gh secret list
, setup-ide
, shebang
, test
, uninstall
, uninstall completions
, uninstall-completions
, update
, version
--quiet
Aliases: -q
Decrease logging verbosity
--progress
Use progress bars
Main class options
Available in commands:
export
, package
, publish
, publish local
, run
, shebang
--main-class
Aliases: -M
Specify which main class to run
--main-class-ls
Aliases: --list-main-class
, --list-main-classes
, --main-class-list
List main classes available in the current context
Markdown options
Available in commands:
bsp
, compile
, dependency-update
, doc
, export
, fix
, fmt
, format
, scalafmt
, package
, publish
, publish local
, repl
, console
, run
, setup-ide
, shebang
, test
--enable-markdown
Aliases: --markdown
, --md
Enable markdown support.
Package options
Available in commands:
--output
Aliases: -o
Set the destination path
--force
Aliases: -f
Overwrite the destination file, if it exists
--library
Generate a library JAR rather than an executable JAR
--src
Aliases: --jar-sources
, [deprecated] --source
, --sources
, --sources-jar
Generate a source JAR rather than an executable JAR
--doc
Aliases: --javadoc
, --scaladoc
Generate a scaladoc JAR rather than an executable JAR
--assembly
Generate an assembly JAR
--preamble
For assembly JAR, whether to add a bash / bat preamble
--main-class-in-manifest
[Internal] For assembly JAR, whether to specify a main class in the JAR manifest