Get To Know A Command : jdeps

by rgrunber

Well time sure flies. I can’t believe I haven’t made a post since the end of last year. It’s been quite busy these past few months but I’d like to think I haven’t completely dropped off the map in terms of Fedora contributions.

Today I’d like to talk about ‘jdeps’. It’s such an awesome tool for helping visualize dependencies. A little while ago I needed to convert about 30 Java packages to proper OSGi bundles (with proper Import-Package statements) and this tool really simplified the task.

mvn -DincludeScope=runtime depdendency:copy-depdendencies
jdeps -dotoutput=result/ target/dependency/*.jar

If you only care about dependencies at the jar level (using Require-Bundle), then you can even add a ‘-s’ flag to jdeps. The tool is part of the Java OpenJDK Development package (eg. java-1.8.0-openjdk-devel) shipped within Fedora.

As an example, it was quite easy to generate a nice dependency graph of the java library docker-client.