-
Notifications
You must be signed in to change notification settings - Fork 159
NoClassDefFoundError: scoverage/Invoker$ #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Disabling the gatling plugin make it work. Is there known incompatibility ? |
From http://d.hatena.ne.jp/lranran123/20150423/1429754799 |
Have a similar issue when I use a Docker image that built with sbt docker:stage
|
It sounds like something else is fiddling with the classpaths of the compiler. If it can't find scoverage.Invoker$ then it means the runtime.jar isn't being passed to the source. Are there other plugins at play here? |
Hi all, |
Setting "coverageEnabled.in(Test, test) := true" in my build.sbt file saves my day ! |
Does version 1.3.1 fix this? See #87 |
I updated from:
to |
Actually, I take back what I said. I'm still seeing this error at run-time. |
Do you have a repro we can try? |
I have access to Kevin's project. It's a service, using a library that has sbt coverage in its plugins. It tests just fine, but the jar that it ends up building, and that then we release, still has the instrumentation on it. So whenever it's used in a situation that doesn't include the plugin (for instance, at run time of the service), then the classes fail to load, as they all want to still report their coverage to the plugin. So now the question is to figure out how in the world do the output jars in /target, which other plugins will use to cut a release, end up having the coverage instrumentation still in them. |
I think that means that you now need to do a "sbt clean" after any scoverage testing before running anything like "sbt package", or you risk packaging up instrumented classes, as you have found. If that is the case, it should be easy to create an isolated repro case. I'm not sure what the fix would be. It does seem like putting the instrumented classes in a separate dir would avoid lots of niggling and hard to anticipate bugs like this one, but obviously @sksamuel changed that for a reason (my guess is lots of niggling and hard to track down bugs). @sksamuel ? I don't have much time to repro or fix this at the moment, but hopefully this will help. Try a "sbt clean" as a workaround? |
Hi folks, Forcing scala-scoverage-runtime >= 1.1.0 fixes this issue when defining custom test environments (unit tests run fine). sbt clean in all instances did not help, neither did wholesale deletion of target. Cheers, Rowland |
remember that tasks in sbt can be name-spaced; so eg, using one of the pre-built configurations provided by sbt (Test), works for me: coverageEnabled in Test := true and given this, i'm not so sure this Issue is a bug; (Tasks & Settings) key namespaces (aka configurations) are an essential part of sbt architecture. What's more the auto-plugin interface for building sbt plugins (as far as i can tell) doesn't really have an organic/native way to implement context-specific behavior (of the plug-in)--so it seems the sbt devs decided to delegate this to the user and provided the configurations api for this purpose. (The other template configurations supplied by sbt, along with Test, are Compile, Runtime, and IntegrationTest.) |
if this is not treated as a bug, which is reasonable after reading @alexland description. one should create a logger warning telling the user to configure correctly and update documentation. however, i would prefer "fixing" the actual problem |
I am not sure if I am having a related issue or not. The issue I am having is essentially described here: The main issue is that I am running tests in a custom configuration. when I turn coverage on in the multi-project built running "test" works for all projects. When running e2e:test I get the infamous: Cause: java.lang.ClassNotFoundException: scoverage.Invoker$ exception. It seems that the test code is getting instrumented, but that the dependencies are not there when running the tests. Is this related or perhaps a separate issue? |
Hi, we're experiencing this problem since yesterday on all our machines but one. We first thought this was brought down upon us by updating sbt-scoverage form 1.3.3 to 1.3.5 but a downgrade didn't solve the error. If we run
If we disable the scoverage plugin by either config or also by removing the dependency then we get the following error on several tests:
This is extremely confusing because if I remove the plugin from the project and run Can anyone shed some light on this? |
I was able to solve the This seems to relate to #153 and #128. I would consider them high priority issues. We've currently removed scoverage from our projects because there seems to be now way right now to not pollute the produced binaries. As a workaround our CI server adds the plugin via script and executes the coverage tasks to produce the desired reports. |
Hi guys, I was having the same problem: I read through this thread and added sCoverage to my dependencies in build.sbt (v 1.1.0). To provide some context, I'm building my project on Jenkins and then ssh-ing the target to a different machine, and I'm trying to run it from that machine. After this point I got a new error: It seems that I would need some file that is not included by the command My solution is a quite ad-hoc solution, but I decided to post it here hoping that in can help some of you. What I did was to first run my tests, and then dist with the coverageOff. This way, files in your target won't depend on anything related with sCoverage and you will be able to run them.
|
setting this fixed the problem for me |
@mig-foxbat Thanks for the hint. |
+1 for the issue. lazy val MyIntegrationTest = config("it") extend Test
lazy val itSettings: Seq[Setting[_]] = inConfig(MyIntegrationTest)(sbt.Defaults.testSettings)
parallelExecution in MyIntegrationTest := false I've tried all of the suggestions above including: coverageEnabled in Test := true
coverageEnabled in MyIntegrationTest := true Writing a command that adds the status to the scope it exactly like in the plugin: commands += Command.single("enableCoverage"){ (state, trueOrFalse) =>
val extracted = Project.extract(state)
val newSettings = extracted.structure.allProjectRefs flatMap { proj =>
import ScoverageSbtPlugin._
println("here it is:" + trueOrFalse.toBoolean)
Seq(
coverageEnabled in proj := true,
coverageEnabled in (proj, Test, test) := true,
coverageEnabled in (proj, MyIntegrationTest, test) := true,
libraryDependencies in proj ++= {
if (trueOrFalse.toBoolean) Seq(
OrgScoverage % (ScalacRuntimeArtifact + "_" + scalaBinaryVersion.value) % DefaultScoverageVersion % "provided" intransitive(),
OrgScoverage % (ScalacPluginArtifact + "_" + scalaBinaryVersion.value) % DefaultScoverageVersion % "provided" intransitive()
) else Nil
}
)
}
extracted.append(newSettings, state)
} Unfortunately I still get the exception for my integration tests. |
I also seem to also have this issue when trying to use it on a custom defined test configuration:
It works for my unit tests, but not my functional tests. |
Observing this as well. Putting |
Hello. Today, I just add coverageOff after 'test' word, staying as follows: Cheers, Roberto |
I was able to resolve this by explicitly adding the scalac-scoverage dependencies to my other test configuration: .settings(libraryDependencies += "org.scoverage" %% "scalac-scoverage-runtime" % "1.1.1" % EndToEndTest) |
I also experienced this issue on a subproject where the Gatling plugin was enabled. I noticed that the coverage was running the - addCommandAlias("testCoverage", "; clean; coverage; test; coverageOff; coverageReport; coverageAggregate")
+ addCommandAlias("testCoverage", "; clean; coverage; test:test; coverageOff; coverageReport; coverageAggregate") |
Adding coverageOff after test in my addCommandAlias in build.sbt fixed this issue for me as well |
";coverage;test;coverageOff;coverageReport;coverageAggregate" works for me as well in a multi-module build (using plugin version 1.3.5). If this is how it is supposed to be done, it should be documented somewhere. |
Had the same issue for Scala.js sub-project. The only way I was able to fix it is by redefining I am really curious if this is a known issue or |
@serhiip Your's is a new usage query, please could you ask this on stackoverflow? This old issue should now be closed. |
Yes, this issue is a can of different issues. All of then should be fixed now. If similar problems arise, please open new issues. @serhiip, if you open new issue (here on on stackoverflow), write how to reproduce your issue (what tasks to execute). |
1.6.8 seems to be broken again, I downgraded to 1.3.3. |
try running |
scoverage 1.1.0
sbt : 0.13.8
I've encountered the following error :
It's a multiproject build and this issue happens only on one subproject…
The text was updated successfully, but these errors were encountered: