Legacy upgrade guide
These instructions are for projects upgrading from older ScalaPB releases. For current release lines, see the upgrade guide.
Migrating to ScalaPB 0.7.x
From version 0.7.0 and onwards, ScalaPB artifacts are published under the com.thesamet.scalapb group id instead of the com.trueaccord.scalapb group id.
In addition, all classes in the com.trueaccord.scalapb are moved to the scalapb top-level
package. During 0.7.x, ScalaPB kept type aliases and references in the original com.trueaccord.scalapb
location to ease the migration. Update your imports to the scalapb package.
You will need to "sbt clean" and "sbt compile" again, to make sure the old generated classes are removed and new ones are generated. The generated code should not yield any deprecation warnings.
Since the artifact name has changed, you will need to make sure all your other ScalaPB
dependencies, such as scalapb-json4s and sparksql-scalapb, are updated to 0.7.x. Otherwise,
they will pull an additional copy of ScalaPB from the old group id name.
Migrating from sbt-scalapb to sbt-protoc
In project/scalapb.sbt or project/plugins.sbt, remove the library
dependency on sbt-scalapb.
Add sbt-protoc plugin:
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
If you had a dependency on protoc-jar, it can be removed. sbt-protoc downloads
and invokes protoc itself.
In build.sbt:
Remove this line:
import com.trueaccord.scalapb.{ScalaPbPlugin => PB}
Remove this line:
PB.protobufSettings
If you set up protoc-jar, you can also remove this setting:
PB.runProtoc in PB.protobufConfig := (args =>
com.github.os72.protocjar.Protoc.runProtoc("-v300" +: args.toArray))
Add a value to PB.targets:
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
If you need Java Conversions, flat packages, etc see ScalaPB SBT Settings.
If you are using files like scalapb.proto and Google's well-known proto
change the library dependency from:
"com.trueaccord.scalapb" %% "scalapb-runtime" % "0.11.21" % PB.protobufConfig
to:
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"