I have a project in Scala that I'm trying to upgrade the version from Scala 2.12.3 to 2.12.13, but the process fails in my CI pipeline with the following stacktrace:
[error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
[error] at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)
[error] at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
[error] at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
[error] at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
[error] at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1599)
[error] at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
[error] at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
[error] at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
[error] at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:186)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:176)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:157)
[error] at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:157)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:174)
[error] at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:172)
[error] at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
[error] at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
[error] at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414)
[error] at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:499)
[error] at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
[error] at sbt.internal.inc.Incremental$.apply(Incremental.scala:166)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:491)
[error] at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2177)
[error] at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2134)
[error] at sbt.internal.io.Retry$.apply(Retry.scala:40)
[error] at sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2130)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (Compile / compileIncremental) java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
[error] Total time: 15 s, completed Feb 27, 2021 6:48:04 AM
restoring stty: 500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
The command "sbt clean coverage test coverageReport" exited with 1.
It purely is a compatibility error and the sbt coverage is the culprit. Any idea how to get this resolved?
The issue is that Scala compiler plugins should be fully cross-versioned
we do normally recommend that compiler plugins be published against the full Scala version.
there's no binary compatibility guarantees between two patch releases of scala-compiler.
which means even patch version matters for publishing an artifact
a.b.c
^
For example, compare how wartremover
compiler plugin includes the patch version
wartremover_2.13.3/
wartremover_2.13.4/
wartremover_2.13.5/
whilst scalac-scoverage-plugin
does not
scalac-scoverage-plugin_2.13/
Build CrossVersion.full #306 has addressed this issue for scalac-scoverage-plugin
however it has not yet been released.