The first step in modularizing your application is to understand its dependency graph. Let's create a dependency graph for our application. And for that, we make use of jdeps tool. If you are wondering what jdeps tool is, stop right away and read the recipe: Using jdeps to find dependencies in a Java application. OK so let's run the jdeps tool:
jdeps -summary -R -cp calculator/lib/*:math_util/out/*:banking_util/out/* calculator/out/calculator.jar
We are asking jdeps to give us a summary of the dependencies of our calculator.jar and then do this recursively for each dependency of calculator.jar. And the output we get is:
banking.util.jar -> java.base calculator.jar -> banking_util/out/banking.util.jar calculator.jar -> calculator/lib/jackson-databind-2.8.4.jar ...