So jdeps can recursively identify all dependencies given a list of the
jars that my application is made of. Assume my main application jar is
app.jar and it depends (per gradle or maven dependencies resolution) on
following libraries like so:

app.jar ----> a.jar, b.jar
a.jar --> x.jar, y.jar, z.jar
x.jar -> profile1
y.jar -> profile2
z.jar -> profile3

And now assume that the app.jar in reality depends only on the part of
a.jar that depends only on x.jar. In other words in reality statically
(no reflection) my application does not really depend on y.jar and z.jar
and only needs compact1 to execute properly. There are libraries that
are "well focused" and have very few dependencies and there are those
that pull ton of dependencies even though an application may only be
using 5% of it.

Would jdeps show only real or all dependencies in this case? If latter
would it show enough information that can be analyzed to determine that
y.jar and z.jar are not really needed and can be removed from my deployment?

Would Java 9 jdeps work differently in this case? Would jlink be able to
figure the "real" dependencies and only pull really needed JRE modules
into the output image?

Waldek

Reply via email to