Skip to content

v1.15.0

Latest

Choose a tag to compare

@Gedochao Gedochao released this 29 Jun 13:45
ebc1847

Default Scala 3.8.4, Scala Native 0.5.12 & Scala.js 1.22.0

This Scala CLI version bumps the default Scala version to 3.8.4, Scala Native to 0.5.12 and Scala.js to 1.22.0.

scala-cli version
# Scala CLI version: 1.15.0
# Scala version (default): 3.8.4
scala-cli -e 'println("Hello from Scala.js 1.22.0!")' --js
# Compiling project (Scala 3.8.4, Scala.js 1.22.0)
# Compiled project (Scala 3.8.4, Scala.js 1.22.0)
# Hello from Scala.js 1.22.0!
scala-cli -e 'println("Hello from Scala Native 0.5.12!")' --native
# Compiling project (Scala 3.8.4, Scala Native 0.5.12)
# Compiled project (Scala 3.8.4, Scala Native 0.5.12)
# Hello from Scala Native 0.5.12!

Scala 3.8.4 was added by @Gedochao in #4299
Scala Native 0.5.12 was added by @WojciechMazur in #4286
Scala.js 1.22.0 was added by @Gedochao in #4344

JShell support in repl

scala-cli repl can now use JShell as its REPL backend, enabled with the --jshell (--jsh) flag. JShell is also picked automatically for pure-Java projects. The project's classpath (including dependencies) is available inside the JShell session, so you can play with your code (and even reference Scala classes via reflection). JShell requires JDK 9 or newer.

package demo;
public class HelloJShell {
  public static String greet() { return "Hello from JShell!"; }
}
System.out.println(demo.HelloJShell.greet());
scala-cli repl demo/HelloJShell.java --jshell --jvm 17 --repl-quit-after-init --repl-init-script-file hi.jsh

Note: It is possible to explicitly disable JShell on pure Java projects and revert to using Scala REPL with --jshell=false.

Added by @Gedochao in #4262

java snippets in Markdown inputs (experimental ⚡️)

Scala CLI can now compile and run java code blocks inside Markdown inputs, mirroring the existing support for scala snippets. A java snippet is treated like a regular .java input (its body is emitted as Java source without any wrapping). As with other Markdown features, this requires --power.

# Java in Markdown

```java
public class HelloMarkdown {
  public static void main(String[] args) {
    System.out.println("Hello from a Java snippet in Markdown!");
  }
}
```
scala-cli --power HelloMarkdown.md

Added by @Gedochao in #4284

WebAssembly support (experimental ⚡️)

Scala CLI can now compile and run Scala.js through the experimental Scala.js WebAssembly backend. Enable it with the --js-emit-wasm flag (or the //> using wasm directive) together with ES module output (--js-module-kind es / //> using jsModuleKind es).

The Wasm output runs on a JavaScript host that embeds a Wasm engine. Scala CLI does not bundle any of these runtimes — you have to install Node.js (the default), Deno or Bun yourself, then select one with --js-runtime. See the Scala.js with Wasm guide for the details and runtime version requirements.

//> using wasm
//> using jsModuleKind es

@main def hello(): Unit = println("Hello from Wasm!")
# Node.js is the default runtime - no runtime flag needed
scala-cli run HelloWasm.scala --power
# run the same Wasm output on Deno
scala-cli run HelloWasm.scala --power --js-runtime deno
# ...or on Bun
scala-cli run HelloWasm.scala --power --js-runtime bun

Added by @lostflydev in #4176

JUnit 5 (Jupiter) support

The test runner now supports JUnit 5 (Jupiter) via the jupiter-interface test interface, for both Scala and pure-Java tests. JUnit 5 requires Java 17 or newer.

//> using test.dep com.github.sbt.junit:jupiter-interface:0.19.0
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*

class MyJupiterTests {
  @Test
  def addition(): Unit = {
    assertEquals(4, 2 + 2)
    println("Hello from JUnit 5 / Jupiter!")
  }
}
scala-cli test MyJupiterTests.test.scala --jvm 17

Added by @Gedochao in #4304

SBT 2.x export

The export sub-command can now generate SBT 2.x builds (the default SBT version used for the export is now 2.0.0). Pick a specific version with --sbt-version.

@main def hello(): Unit = println("Hello from an SBT 2.x export!")
scala-cli --power export hello.scala --sbt --sbt-version 2.0.0 -o sbt-project
cat sbt-project/project/build.properties

Added by @Gedochao in #4327

Visual Studio 2026 support on Windows

When building Scala Native (or packaging GraalVM native images) on Windows, Scala CLI locates the MSVC toolchain from your Visual Studio installation. It now also detects Visual Studio 2026, and bundles the matching Visual C++ redistributable (vcredist) in the generated MSI installers.

Added by @Gedochao in #4331

Dropped Ammonite support

The Ammonite REPL integration has been removed (it was deprecated back in v1.13.0). The --ammonite (--amm), --ammonite-version and --ammonite-arg options are gone from scala-cli repl; use the default Scala REPL (or the new JShell backend for Java projects) instead.

scala-cli repl --ammonite

Added by @Gedochao in #4283

Features

Fixes

  • Restore BSP base directory to the original workspace regardless of permissions/ownership by @Gedochao in #4273
  • Improve dependency update actionable diagnostic handling for slow/unresponsive custom repositories by @Gedochao in #4272
  • Improve error for when JVM-only dependencies are not found on other platforms by @Gedochao in #4281
  • Don't save duplicate .scalafmt.conf if unnecessary by @Gedochao in #4291

Deprecations and removals

Build and internal changes

  • Compile the directives-parser example in Scala CLI v1.14.0 release notes by @Gedochao in #4278
  • Retire legacy KEYGRIP secret by @Gedochao in #4275
  • update-installation-script, update-centos and update-debian can't run in parallel by @Gedochao in #4277
  • Track threads & futures spawned in integration tests to make sure logs are in chronological order by @Gedochao in #4293
  • Mark Scala 2 nightly tests as flaky by @Gedochao in #4317
  • Disable test parallelism for unit tests on the CI by @Gedochao in #4316
  • Ensure scala-cli.sh logs to stderr by @alexarchambault in #4301
  • Add an extra test for VS detection on Windows + a small refactor by @Gedochao in #4328
  • Cut MacOS integration tests down to just sanity tests by @Gedochao in #4333
  • Add anti-regression tests for #4329 by @Gedochao in #4332
  • Treat Mill wrapper changes as build changes by @Gedochao in #4347

Updates

New Contributors

Full Changelog: v1.14.0...v1.15.0