Directives
using directives
Benchmarking options
Add benchmarking options
//> using jmh
value
//> using jmhVersion
value
Examples
//> using jmhVersion 1.37
BuildInfo
Generate BuildInfo for project
//> using buildInfo
Examples
//> using buildInfo
Compiler options
Add Scala compiler options
//> using option
option
//> using options
option1 option2 …
Examples
//> using option -Xasync
//> using test.option -Xasync
//> using options -Xasync -Xfatal-warnings
Compiler plugins
Adds compiler plugins
using plugin
org:
name:
ver
Examples
//> using plugin org.typelevel:::kind-projector:0.13.2
Compute Version
Method used to compute the version for BuildInfo
//> using computeVersion
method
Examples
//> using computeVersion git
//> using computeVersion git:tag
//> using computeVersion git:dynver
Custom JAR
Manually add JAR(s) to the class path
//> using jar
path
//> using jars
path1 path2 …
Examples
//> using jar /Users/alexandre/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/chuusai/shapeless_2.13/2.3.7/shapeless_2.13-2.3.7.jar
//> using test.jar /Users/alexandre/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/chuusai/shapeless_2.13/2.3.7/shapeless_2.13-2.3.7.jar
//> using sourceJar /path/to/custom-jar-sources.jar
//> using sourceJars /path/to/custom-jar-sources.jar /path/to/another-jar-sources.jar
//> using test.sourceJar /path/to/test-custom-jar-sources.jar
Custom sources
Manually add sources to the project. Does not support chaining, sources are added only once, not recursively.
//> using file
path
//> using files
path1 path2 …
Examples
//> using file utils.scala
Dependency
Add dependencies
//> using dep
org:
name:
ver
Examples
//> using dep com.lihaoyi::os-lib:0.9.1
//> using test.dep org.scalatest::scalatest:3.2.10
//> using test.dep org.scalameta::munit:0.7.29
//> using dep "tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar"
Exclude sources
Exclude sources from the project
//> using exclude
pattern
//> using exclude
pattern1 pattern2 …
Examples
//> using exclude utils.scala
//> using exclude "examples/*" "*/resources/*"
//> using exclude "*.sc"
JVM version
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.
//> using jvm
value
Examples
//> using jvm 11
//> using jvm adopt:11
//> using jvm graalvm:21
Java home
Sets Java home used to run your application or tests
//> using javaHome
path
Examples
//> using javaHome /Users/Me/jdks/11
Java options
Add Java options which will be passed when running an application.
//> using javaOpt
options
Examples
//> using javaOpt -Xmx2g, -Dsomething=a
//> using test.javaOpt -Dsomething=a
Java properties
Add Java properties
//> using javaProp
key=value
//> using javaProp
key
Examples
//> using javaProp foo1=bar, foo2
//> using test.javaProp foo3=bar foo4
Javac options
Add Javac options which will be passed when compiling sources.
//> using javacOpt
options
Examples
//> using javacOpt -source 1.8 -target 1.8
//> using test.javacOpt -source 1.8 -target 1.8
Main class
Specify default main class
//> using mainClass
main-class
Examples
//> using mainClass HelloWorld
ObjectWrapper
Set the default code wrapper for scripts to object wrapper
//> using objectWrapper