Skip to content

Runtime dependency on scoverage? #84

Closed
@gijsbert802

Description

@gijsbert802

When I build artifacts (a jar) using sbt coverage test package, the class files in the artifact have references to scoverage files. I then get runtime exceptions when using the jar.
This didn't happen before version 1.0 I think.

For example, this is the output of a unit test that uses the class DocumentGenerator from my jar:

[info] Exception encountered when attempting to run a suite with class name: nl.zorgdomein.messaging.MyTest *** ABORTED ***
[info]   java.io.FileNotFoundException: /var/lib/jenkins/jobs/my-lib/workspace/target/scala-2.11/scoverage-data/scoverage.measurements.52 (No such file or directory)
[info]   at java.io.FileOutputStream.open(Native Method)
[info]   at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
[info]   at java.io.FileWriter.<init>(FileWriter.java:107)
[info]   at scoverage.Invoker$$anonfun$1.apply(Invoker.scala:45)
[info]   at scoverage.Invoker$$anonfun$1.apply(Invoker.scala:45)
[info]   at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:190)
[info]   at scala.collection.concurrent.TrieMap.getOrElseUpdate(TrieMap.scala:633)
[info]   at scoverage.Invoker$.invoked(Invoker.scala:45)
[info]   at nl.zorgdomein.mylib.DocumentGenerator$class.$init$(DocumentGenerator.scala:27)
[info]   ...

Output of javap -c DocumentGenerator.class looks like this:

Compiled from "DocumentGenerator.scala"
public abstract class nl.zorgdomein.mylib.DocumentGenerator$class {
  public static java.io.ByteArrayOutputStream toRtf(nl.zorgdomein.mylib.DocumentGenerator, java.lang.String);
    Code:
       0: getstatic     #13                 // Field scoverage/Invoker$.MODULE$:Lscoverage/Invoker$;
       3: iconst_1
       4: ldc           #15                 // String /var/lib/jenkins/jobs/my-lib/workspace/target/scala-2.11/scoverage-data
       6: invokevirtual #19                 // Method scoverage/Invoker$.invoked:(ILjava/lang/String;)V
       9: aload_0
      10: ldc           #21                 // String application/rtf
      12: aload_1
      13: invokestatic  #25                 // Method transform:(Lnl/zorgdomein/mylib/DocumentGenerator;Ljava/lang/String;Ljava/lang/String;)Ljava/io/ByteArrayOutputStream;
      16: areturn

Is this supposed to happen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions