sbt scoverage plugin error: java.lang.NoSuchMethodError: sbt.package$.singleFileJsonFormatter()Lsjsonnew/JsonFormat;

i am trying to use scoverage for code coverage in my plugins.sbt i have added

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")

here is my build.sbt

ThisBuild / scalaVersion := "2.13.1"
coverageEnabled := true

here is file

sbt.version = 1.2.8

upon building project, i am getting the following exception

java.lang.NoSuchMethodError: sbt.package$.singleFileJsonFormatter()Lsjsonnew/JsonFormat;
[error]     at scoverage.ScoverageKeys$.coverageSourceRoot$lzycompute(ScoverageKeys.scala:22)
[error]     at scoverage.ScoverageKeys$.coverageSourceRoot(ScoverageKeys.scala:22)
[error]     at scoverage.ScoverageSbtPlugin$.coverageReport0$lzycompute(ScoverageSbtPlugin.scala:215)
[error]     at scoverage.ScoverageSbtPlugin$.coverageReport0(ScoverageSbtPlugin.scala:203)
[error]     at scoverage.ScoverageSbtPlugin$.projectSettings(ScoverageSbtPlugin.scala:68)
[error]     at sbt.internal.Load$.$anonfun$resolveProject$3(Load.scala:1062)
[error]     at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:240)
[error]     at scala.collection.immutable.List.foreach(List.scala:388)

i have tried to downgrade to the version 2.0.5 and 2.0.4 as given here


  • The problem is the version of sbt you are using. Here you have some links for reference

    Method sbt.package$.singleFileJsonFormatter() appeared in sbt 1.3.0

    So sbt-native-packager 1.9.4 seems to be binary incompatible with sbt 1.2.8-

    Either upgrade sbt to 1.3.0+ in project/ (current sbt is 1.8.2) or downgrade sbt-native-packager as you did in your next question Unable to make docker image using sbt-native-packager