1

I am analyzing the dependencies of a large java project. I found jdeps for analyzing static dependencies. It is showing a large graph of dependencies. Many jars are not being found, though, for example the jdbc drivers, because they are loaded with "Class.forName()" in the code and jdeps only finds static dependencies.

What is the correct way to analyze the dynamic dependencies of java libraries as well ?

Edu
  • 160
  • 10
  • You could catch them with JVM's -verbose:class, which logs every class loaded. It could take some work to separate classes loaded by any container or app server you are using. But full paths are there, so not impossible to get useful information. – joshp Mar 25 '19 at 08:58
  • Would this work even if the class is not used during the test ? e.g. I start catching with -verbose:class, but I don't use the mysql jdbc driver during the test. Would the jdbc dependency still be catched? I ask since a thorough and 100% covering test would be impossible.. – Edu Mar 25 '19 at 09:09
  • It catches whatever classes are loaded in the environment where you collect the data. So tracking JVM output for unit tests will not tell you what is loaded in production. JVM output for a development or integration test server might tell you what you want to know. It depends on your enviornment. It just has to be a full deployment of the components you are interested in, even if the test activity is very limited. – joshp Mar 25 '19 at 09:22

0 Answers0