Reputation: 1217
I want to create a sbt plugin
this is my project
build.sbt file:
lazy val root = (project in file(".")).
settings(
name := "test-plagin",
version := "0.1.0",
organization := "com.test",
scalaVersion := "2.13.0",
sbtPlugin := true,
)
main file with task
import sbt.{AutoPlugin, TaskKey}
object HelloPlugin extends AutoPlugin {
object autoImport {
val sayHello: TaskKey[Unit] = TaskKey("saying hello")
}
import autoImport._
override def projectSettings = Seq(
sayHello := {
println("hello")
}
)
}
During compiling I get an error: java.lang.NoClassDefFoundError: scala/collection/immutable/StringOps When I change the version to 2.12.6 - compiling is success. How I can fix error in 2.13?
Upvotes: 0
Views: 493
Reputation: 51703
sbt is written in Scala 2.12
https://github.com/sbt/sbt/blob/develop/project/Dependencies.scala#L9
https://github.com/sbt/sbt/issues/5032
So you should use Scala 2.12 for sbt plugins.
Upvotes: 2