question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JaVers dependency on Google Guava

See original GitHub issue

As documented I just ran the below code to view the diff. It seems that Google Guava is required as a runtime dependency for the below code to work.

Javers javers = JaversBuilder.javers().build();
Person tommyOld = new Person("tommy", "Tommy Smart");
Person tommyNew = new Person("tommy", "Tommy C. Smart");

Diff diff = javers.compare(tommyOld, tommyNew);
System.out.println(diff.prettyPrint());

The code above throws an exception as shown below:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
	at org.javers.core.Changes.<init>(Changes.java:35)
	at org.javers.core.diff.Diff.groupByObject(Diff.java:88)
	at org.javers.core.diff.Diff.toString(Diff.java:129)
	at org.javers.core.diff.Diff.prettyPrint(Diff.java:120)
	...
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 5 more

Not sure how the below line of code is used in org.javers.core.Changes.java There are 3 more references in other classes HibernateConfig.java, JaversSpringJpaApplicationConfig.java and JaversSpringMongoApplicationConfig.java

The above code can be easily replaced with standard Java code to remove dependency on Goolge Guava.

Do let me know if these changes can be done. I will submit a PR.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
shirishpandharikarcommented, Aug 7, 2018

@PodusovMaxim Thanks for reporting this. This is something that got added after #692 was reported and fixed. Will submit a PR.

0reactions
bartoszwalacikcommented, Jul 4, 2020

fixed in 5.10.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release notes — JaVers Documentation
5.8.12. released on 2020-03-31. 951 Dependencies management fix in javers-core . Guava and joda-time are now correctly marked as optional in pom.xml ....
Read more >
org.javers : javers-persistence-mongo : 5.11.2 - Maven Central
Dependencies : org.javers:javers-core · org.mongodb:mongodb-driver-legacy · com.google.guava:guava.
Read more >
Duplicate class in modules error when I try to use Javers in ...
You should get to the bottom of your dependencies and really understand what you are pulling in, but a quick fix could be...
Read more >
org.javers » javers-core » 6.7.1 - Maven Repository
Compile Dependencies (4) ; JSON Lib Apache 2.0, logo, com.google.code.gson » gson ; Core Utils Apache 2.0, logo, com.google.guava » guava ( ...
Read more >
org.javers.guava.MultimapTypeAdapter Maven / Gradle / Ivy
org.javers.guava.MultimapTypeAdapter maven / gradle build tool code. The class is part of the package ➦ Group: org.javers ➦ Artifact: javers-core ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found