Skip to main content

Directives

using directives

Compiler options

Add Scala compiler options

//> using option option

//> using options option1, option2

Examples

//> using 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"

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"

Custom sources

Manually add sources to the Scala CLI project

//> using file hello.sc

//> using files Utils.scala, Helper.scala …

Examples

//> using file "utils.scala"

Dependency

Add dependencies

//> using lib "org:name:ver"

Examples

//> using lib "org.scalatest::scalatest:3.2.10"

//> using lib "org.scalameta::munit:0.7.29"

//> using lib "tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar"

Java home

Sets Java home used to run your application or tests

//> using java-home path

//> using javaHome path

Examples

//> using java-home "/Users/Me/jdks/11"

Java options

Add Java options which will be passed when running an application.

//> using java-opt options

//> using javaOpt options

Examples

//> using javaOpt "-Xmx2g", "-Dsomething=a"

Java properties

Add Java properties

//> using javaProp key=value //> using javaProp key

Examples

//> using javaProp "foo1=bar", "foo2"

Javac options

Add Javac options which will be passed when compiling sources.

//> using javac-opt options

//> using javacOpt options

Examples

//> using javacOpt "source", "1.8"

"target", "1.8"

Main class

Specify default main class

//> using main-class main class

//> using mainClass main class

Examples

//> using main-class "helloWorld"

Packaging

Set parameters for packaging

//> using packaging.packageType "package type"

//> using packaging.output "destination path"

Examples

//> using packaging.packageType "assembly"

//> using packaging.output "foo"

//> using packaging.provided "org.apache.spark::spark-sql"

Platform

Set the default platform to Scala.js or Scala Native

//> using platform (jvm|scala-js|scala-native)+

Examples

//> using platform "scala-js"

//> using platform "jvm", "scala-native"

Publish

Set parameters for publishing

//> using publish.organization "value" //> using publish.name "value" //> using publish.version "value"

Examples

//> using publish.organization "io.github.myself"

//> using publish.name "my-library"

//> using publish.version "0.1.1"

Publish (contextual)

Set contextual parameters for publishing

//> using publish.computeVersion "value" //> using publish.ci.repository "value" //> using publish.secretKey "value"

Examples

//> using publish.computeVersion "git:tag"

//> using publish.ci.repository "central-s01"

//> using publish.secretKey "env:PUBLISH_SECRET_KEY"

Repository

Add a repository for dependency resolution

//> using repository repository

Examples

//> using repository "jitpack"

//> using repository "sonatype:snapshots"

//> using repository "https://maven-central.storage-download.googleapis.com/maven2"

Resource directories

Manually add a resource directory to the class path

//> using resourceDir path

//> using resourceDirs path1, path2

Examples

//> using resourceDir "./resources"

Scala Native options

Add Scala Native options

//> using nativeGc value

//> using nativeMode value

//> using nativeVersion value

//> using nativeCompile value1, value2

//> using nativeLinking value1, value2

//> using nativeClang value

//> using nativeClangPP value

//> using nativeEmbedResources true|false

Examples

//> using nativeVersion "0.4.0"

Scala version

Set the default Scala version

//> using scala version+

Examples

//> using scala "3.0.2"

//> using scala "2.13"

//> using scala "2"

//> using scala "2.13.6", "2.12.16"

Scala.js options

Add Scala.js options

//> using jsVersion value

//> using jsMode value

//> using jsModuleKind value

//> using jsSmallModuleForPackage value1, value2

//> using jsCheckIr true|false

//> using jsEmitSourceMaps true|false

//> using jsDom true|false

//> using jsHeader value

//> using jsAllowBigIntsForLongs true|false

//> using jsAvoidClasses true|false

//> using jsAvoidLetsAndConsts true|false

//> using jsModuleSplitStyleStr value

//> using jsEsVersionStr value

Examples

//> using jsModuleKind "common"

Test framework

Set the test framework

//> using testFramework class_name | //> using `test-framework` class_name

Examples

//> using testFramework "utest.runner.Framework"

target directives

Platform

Require a Scala platform for the current file

//> using target.platform platform

Examples

//> using target.platform "scala-js"

//> using target.platform "scala-js", "scala-native"

//> using target.platform "jvm"

Scala version

Require a Scala version for the current file

//> using target.scala version

Examples

//> using target.scala "3"

//> using target.scala.>= "2.13"

//> using target.scala.< "3.0.2"

Scope

Require a scope for the current file

//> using target.scope scope

Examples

//> using target.scope "test"