Skip to content
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

Upgrade to JaCoCo 0.8.0 #106

Closed
rmcloughlin opened this issue Jan 29, 2018 · 12 comments
Closed

Upgrade to JaCoCo 0.8.0 #106

rmcloughlin opened this issue Jan 29, 2018 · 12 comments

Comments

@rmcloughlin
Copy link

JaCoCo 0.8.0 is out now: https://github.com/jacoco/jacoco/releases

sbt-jacoco currently depends on version 0.7.9

@stijndehaes
Copy link

I quickly tried the upgrade and got two compile errors one was easily fixed. By using
CRC64.classId(..) instead of CRC64.checksum(..).

The other compile error is also in the class FilteringClassAnalyzer on line 67 a new MethodAnalyzer is returned except in jacoco 0.8.0 the constructor for this method is not publicly accessible anymore. And I don't know what to change this to without spending more effort. Anybody else has a some more info?

@dbhatte
Copy link

dbhatte commented Jun 19, 2018

I also tried the same. But, it cannot be done as we are relying on the internal implementation.
See the bug report that I raised on jacoco
jacoco/jacoco#698 (comment)

We will need to refactor the sbt-jacoco codebase. Anybody wants to take this up?

@marchof
Copy link

marchof commented Jun 19, 2018

I'm a developer from the JaCoCo project. I see sbt depends on internals because it implements its own filters for Scala artifacts.

At JaCoCo we now have many filters in place, e.g. for Kotlin, Lombok etc. What about contributing Scala filters to the JaCoCo project?

@stringbean
Copy link
Member

Thanks for the input @marchof.

When I took over the project the filters were still in the early stages of development. Now that they've shipped I'll take a look and see what we can do!

@Godin
Copy link

Godin commented Jul 4, 2018

Hi @stringbean , I'm another developer from the JaCoCo project. While @marchof is right that ideally dependency on internals should be removed, to me (based on very limited knowledge of Scala) seems that you can easily override ClassCoverageImpl#addMethod instead of ClassAnalyzer#visitMethod to achieve the same with JaCoCo 0.8.0 as now with 0.7.9 i.e. to overcome difficulty in upgrade described by @dbhatte #106 (comment) IMO this will allow to resolve #111 and won't be dirtier than now. Hope this helps.

@dbhatte
Copy link

dbhatte commented Sep 18, 2018

You solve this problem by overriding the Jacoco version in the plugins.sbt
e.g.
dependencyOverrides ++= Seq( "org.jacoco" % "org.jacoco.core" % "0.8.2", "org.jacoco" % "org.jacoco.report" % "0.8.2", )

This also solves the problem of making Jacoco work with Java 10

@raboof
Copy link

raboof commented May 7, 2019

It looks like this was achieved by #119 ?

@dbhatte
Copy link

dbhatte commented May 9, 2019

Yes, I think so

@SahilAggarwalG
Copy link

when new version of sbt-jacoco will release with jacoco 0.8.2

@SahilAggarwalG
Copy link

You solve this problem by overriding the Jacoco version in the plugins.sbt
e.g.
dependencyOverrides ++= Seq( "org.jacoco" % "org.jacoco.core" % "0.8.2", "org.jacoco" % "org.jacoco.report" % "0.8.2", )

This also solves the problem of making Jacoco work with Java 10

when i did this i got the following error :
java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_28bab1d/Offline,

@demjened
Copy link

@SahilAggarwalG I managed to get JaCoCo working with Java 11 / Scala 2.12.8 / SBT 1.2.8 by making the following changes:

// plugins.sbt
val jacocoVersion = "0.8.2"

dependencyOverrides ++= Seq(
  "org.jacoco" % "org.jacoco.core" % jacocoVersion,
  "org.jacoco" % "org.jacoco.report" % jacocoVersion,
  "org.jacoco" % "org.jacoco.agent" % jacocoVersion)

// build.sbt
val jacocoVersion = "0.8.2"

dependencyOverrides ++= Seq(
  "org.jacoco" % "org.jacoco.core" % jacocoVersion % Test,
  "org.jacoco" % "org.jacoco.report" % jacocoVersion % Test,
  "org.jacoco" % "org.jacoco.agent" % jacocoVersion % Test)

(Maybe some of these can be left out, I haven't tried.)

That said, getting sbt-jacoco work on Java 11 without this hack would be really great, so I'm looking forward to the 4.0 release. This is the best plugin for SBT/JaCoCo and I haven't found any alternatives that currently support Java 11. cc @stringbean

@eed3si9n
Copy link
Member

Closing this as fixed in #119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants