Using Java in SciTools can be difficult because of the deep structure of directories. We address the problem by automatically creating an architecture from Java Packages.
Let’s analyze the Spring Framework for Java (https://spring.io/) with Understand and then create a dependencyStructure
Before you can access any java file or class, you have to drill down the whole directory structure. This is making any java structure painful to explore. This is what we call the “Java Staircase” problem (or at least at we do at Emenda USA…)
It takes a lot of clicks to drill-down to the class making the graphs overcomplicated.
Emenda has created a Python Script that automatically creates an Architecture based on the Java Packages contained in the project.
To do so, you simply run the following command:
python JavaPackagesToArchitecture.py <YOUR UDB FILE> <XX>
Where <XX> is a numerical value that set the minimum number of files for an architecture element to be created (including sub-architecture). It can be anything from 0 to, let’s say, infinity… while this may not be really useful… We suggest you use 10.
This will create a architecture xml file named <YOUR UDB FILE>_architecture_package_<XX>.xml that you can now import in your project.
When done, go to:
Graphs >> Dependencies Graph >> By Package (XX)
You will get a useful dependency graph as followed, where all the java files are now organized by Packages (here org.springframework.jdbc)