November 29, 2005

jUse

Posted in Software at 20:32 by graham

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

1 Comment »

  1. John said,

    August 16, 2006 at 05:45

    Your jUse download link doesn’t work. Please can you fix it?

    [graham] Thanks for letting me know John. Fixed.

Leave a Comment

Note: Your comment will only appear on the site once I approve it manually. This can take a day or two. Thanks for taking the time to comment.