Graham King

Solvitas perambulum

jUse

software

I’ve written a small Python program I’m calling jUse which I’m placing here in the hope that someone might find it useful. It analyses a Java project and shows the dependencies of a particular package. I use it to check that my model code doesn’t depend on my controllers, for example.

In the tar.gz (linked at the end) there are two python files: jUse.py and model.py. To run jUse type:

python jUse.py -r /root/of/my/javaProject

The path given should be where your package starts – i.e. there should be a ‘com’, ‘org’, etc directory directly underneath that one. It will analyse the java files in all subdirectories and write a ‘jUse.cache’ file in the current directory.

To Query the dependencies of the ‘net.darkcoding.myproject.model’ package run:

python jUse.py -q net.darkcoding.myproject.model

This will print all the dependencies, including the ‘java’ packages. To Narrow to only the dependencies in your current project use:

python jUse.py -q net.darkcoding.myproject.model -n net.darkcoding.myproject

That’s it. I hope you find it useful. It’s licensed under the GPL. If you do anything cool with it let me know.

Download jUse