scoverage / gradle-scoverage

A plugin to enable the use of Scoverage in a gradle Scala project
Apache License 2.0
53 stars 38 forks source link

NoSuchMethodError with Scala 2.12.13 with version 5 #156

Closed arkangelboss-github closed 3 years ago

arkangelboss-github commented 3 years ago

Hi all!

This seems to be the same issue (with the same stack trace) as in https://github.com/scoverage/scalac-scoverage-plugin/issues/305

Caused by: java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
        at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:130)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1617)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
        at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:95)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:95)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:95)
        at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:168)
        at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:94)
        at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
        at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:84)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
        at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
        at sbt.inc.Incremental$.compile(Incremental.scala:71)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
        at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:159)
        at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:68)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:207)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:189)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:180)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:171)
        at org.gradle.api.internal.tasks.scala.ZincScalaCompiler$Compiler.execute(ZincScalaCompiler.java:86)
        at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:57)
        at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:40)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:113)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:46)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:36)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
        at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:36)
        at org.gradle.workers.internal.IsolatedClassloaderWorker.execute(IsolatedClassloaderWorker.java:54)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:56)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:118)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:412)

Compiling using scala 2.12 builds up to 2.12.12 works fine.

maiflai commented 3 years ago

It seems that the workaround of using the latest upstream plugin doesn't work (https://github.com/scoverage/gradle-scoverage/pull/155 has been kindly submitted to fix this).

Can you try the previous version's workaround?

scoverage {
    scoverageVersion = '1.4.5'
    scoverageScalaVersion = '2.12.13'
}

I need to review that before we can move forward, sorry.

Stu

arkangelboss-github commented 3 years ago

Hi @maiflai! and thanks for looking into this 🥇

NEVER MIND HERE

I tried with the explicit configuration

scoverage {
    scoverageVersion = '1.4.5'
    scoverageScalaVersion = '2.12.13'
}

I get the same issue

Caused by: java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
        at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:130)

LOOK HERE

It turns out I missed a file and it worked with the explicit configuration.

Let me know if I can try to collect more data: I cannot get past version 1.4.5 because the org.scoverage:scalac-scoverage-runtime version is not compiled against the full scala version it seems (see https://mvnrepository.com/artifact/org.scoverage/scalac-scoverage-runtime)

maiflai commented 3 years ago

Sorry for the delay, I've got past my local problems and published 6.0.0 of the plugin which should help you get past 1.4.5.

arkangelboss-github commented 3 years ago

Sorry for the delay, I've got past my local problems and published 6.0.0 of the plugin which should help you get past 1.4.5.

Looking to confirm!

arkangelboss-github commented 3 years ago

It seems the workaround is no longer necessary with version 6.0.0 :)