Skip to main content

Using ScalaPB with Scala 3

Installing in SBT​

Follow the installation instructions. The setup there selects Scala 3 syntax when your project uses Scala 3, including when cross-building with Scala 2.

In build.sbt, select your Scala version:

scalaVersion := "3.3.9"

For a Scala 3-only project, you can set scala3Sources = true directly in scalapb.gen. See Scala 3 generator settings for details and the differences between ScalaPB 0.11.x and 1.x.

Generated code​

The generated code is designed to compile on supported Scala versions with the default compiler settings. Additional settings may require generator options; see the Scala 3 troubleshooting guide.

When upgrading to ScalaPB 1.x, regenerate your sources and review the upgrade guide.