Monday, 25 March 2019

Removing Jacoco library dependency while exporting project as jar

I've implemented jacoco to my project some times ago. The implementation is just like described here: https://medium.com/@android2ee/playing-with-gradle-3-and-some-few-code-coverage-on-android-with-jacoco-47df7c9328ae

classpath "org.jacoco:org.jacoco.core:0.8.3"

and I have no problem on that. (Let's say this is project 1)

But the thing is whenever I'm exporting the project to .jar file. The second project (let's say project 2) that I use the .jar file gives that error on runtime:

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_8ff85ea/Offline;
    at 

I've tracked the error about the library but in reality I don't want to export anything related to jacoco in project 1, because it seems meaningless to me to have that inside the jar file.

How can I keep jacoco out of the jar file?

Thank you for your helps!



from Removing Jacoco library dependency while exporting project as jar

2 comments:

  1. Any solution in this regards? I am also facing the same issue.

    ReplyDelete