scoverage / gradle-scoverage

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

NoClassDefFoundError: scoverage/domain/Coverage #185

Open gabrieljones opened 2 years ago

gabrieljones commented 2 years ago
java.lang.NoClassDefFoundError: scoverage/domain/Coverage
    at scoverage.ScoverageInstrumentationComponent.<init>(ScoveragePlugin.scala:86)
plugins {
  scala
  id("org.scoverage") version "7.0.1"
}

scoverage {
  scoverageVersion.set("2.0.5")
  scoverageScalaVersion.set("2.13.9")
}
maiflai commented 2 years ago

scoverage v2 is not yet supported, sorry.

gabrieljones commented 1 year ago

blocked by #188

naval2608 commented 1 year ago

I see the same issue @gabrieljones for scala version 2.12.17, have you checked it on that scala version by any chance? TIA

naval2608 commented 1 year ago

scoverage v2 is not yet supported, sorry.

@maiflai could you please elaborate? it doesn't support scala 2.13?

gabrieljones commented 1 year ago

scoverage v2 is not yet supported, sorry.

@maiflai could you please elaborate? it doesn't support scala 2.13?

There are three different puzzle pieces here:

They each have their own version.

@maiflai is not referring to the scala compiler version.

ZachManno commented 1 year ago

Same is happening for me, have to update to scala 2.12.17 due to a high severity vulnerability. I tried:

<plugin>
        <groupId>org.scoverage</groupId>
        <artifactId>scoverage-maven-plugin</artifactId>
        <version>1.4.11</version>
        <configuration>
          <scalaVersion>2.12.17</scalaVersion>
          <scalacPluginVersion>2.0.8</scalacPluginVersion>
          <aggregate>true</aggregate>
          <highlighting>true</highlighting>
          ...
 </plugin>

And I'm getting

wrap: java.lang.reflect.InvocationTargetException: scoverage/domain/Coverage: scoverage.domain.Coverage

Full trace:

[ERROR] ## Exception when compiling 76 sources to {my_project}/target/scoverage-classes
java.lang.reflect.InvocationTargetException
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
scala.tools.nsc.plugins.Plugin$.instantiate(Plugin.scala:185)
scala.tools.nsc.plugins.Plugins.$anonfun$loadRoughPluginsList$10(Plugins.scala:60)
scala.collection.immutable.List.map(List.scala:293)
scala.tools.nsc.plugins.Plugins.loadRoughPluginsList(Plugins.scala:60)
scala.tools.nsc.plugins.Plugins.loadRoughPluginsList$(Plugins.scala:40)
scala.tools.nsc.Global.loadRoughPluginsList(Global.scala:45)
scala.tools.nsc.plugins.Plugins.roughPluginsList(Plugins.scala:113)
scala.tools.nsc.plugins.Plugins.roughPluginsList$(Plugins.scala:113)
scala.tools.nsc.Global.roughPluginsList$lzycompute(Global.scala:45)
scala.tools.nsc.Global.roughPluginsList(Global.scala:45)
scala.tools.nsc.plugins.Plugins.loadPlugins(Plugins.scala:149)
scala.tools.nsc.plugins.Plugins.loadPlugins$(Plugins.scala:119)
scala.tools.nsc.Global.loadPlugins(Global.scala:45)
scala.tools.nsc.plugins.Plugins.plugins(Plugins.scala:165)
scala.tools.nsc.plugins.Plugins.plugins$(Plugins.scala:165)
scala.tools.nsc.Global.plugins$lzycompute(Global.scala:45)
scala.tools.nsc.Global.plugins(Global.scala:45)
scala.tools.nsc.plugins.Plugins.computePluginPhases(Plugins.scala:176)
scala.tools.nsc.plugins.Plugins.computePluginPhases$(Plugins.scala:175)
scala.tools.nsc.Global.computePluginPhases(Global.scala:45)
scala.tools.nsc.Global.computePhaseDescriptors(Global.scala:722)
xsbt.ZincCompiler.phaseDescriptors$lzycompute(CallbackGlobal.scala:146)
xsbt.ZincCompiler.phaseDescriptors(CallbackGlobal.scala:140)
scala.tools.nsc.Global$Run.<init>(Global.scala:1236)
xsbt.ZincCompiler$ZincRun.<init>(CallbackGlobal.scala:80)
xsbt.CachedCompiler0.run(CompilerBridge.scala:161)
xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
xsbt.CompilerBridge.run(CompilerBridge.scala:39)
sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179)
sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177)
sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463)
sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:418)
sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405)
sbt.internal.inc.Incremental$.apply(Incremental.scala:171)
sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
sbt_inc.InProcessSbtIncrementalCompiler.compile(InProcessSbtIncrementalCompiler.java:72)
scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:325)
scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:119)
scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:86)
scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:310)
scala_maven.ScalaCompileMojo.execute(ScalaCompileMojo.java:108)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:508)
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:345)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
maiflai commented 1 year ago

@ZachManno - that looks like a Maven build rather than a Gradle one?