depDetectGui(EN)

2019年5月21日

DepDetectGui detects cyclic dependencies (circular dependecies) between java packages using jdeps bundled with JDKs.

It might be regarded as a GUI front-end of jdeps.

This software is actually being used for analysis of our java application which has over 400,000 source lines and around 400 packages. We’re going to continue the improvement of depDetectGui.

Downloading executable jar file

Although this software is open source and you can get all the source code at the last section, you can get also pre-build executable jar file here. (requires Java8 or later).

https://ysugimura.github.io/dist/

General: detecting cyclic dependencies between java packages.

DepDetectGui detects cyclic dependencies in one or more .class folder trees. For example, if you have Sample1, Sample2 classes having reference each other, it will be detected as circular dependencies.

foo
+- bar1
|  +- Sample1
+- bar2
   +- Sample2

Besides depDetectGui can point out which packages a package depends on or being depended on.

Mechanism: Analyzing with jdeps bundled with JDKs.

The mechanism is very simple. Basically it calls jdeps analysis tool, getting that standard-output and analyzing dependencies between packages. But it can show it using GUI so you can easily point out the problems of target .class folder tree.

  1. Specifying .class folder tree invokes jdeps execution and getting dependencies of all the packages.
  2. It shows all packages having cyclic dependencies. Select one of them.
  3. It shows all packages having cyclic dependencies with a 2. package. Select one of them.
  4. It shows all the classes which has that dependencies.

Specifying jdeps

Aside from depDetectGui itself, you need jdeps (in JDK). If the execution PATH doesn’t include jdeps, you should specify the location of jdeps.

Click Set button and specify the location.

If you don’t specify the location of jdeps, depDetectGui executes it as a process simply specifying “jdeps”.

Defining project and selection

DepDetectGui stores multiple project definitions (Multiple Java projects). Selecting one of them invokes analysis of it.

First of all, select List menu.

It shows Project List like the following. Select one of them and hit OK.

Hit New button to create a project. Specify project name and at least one .class folder path.

Updating project

If you’ve changed any .class in the folder path, just select Update in the menu. DepDetectGui reloads the whole .class files in the folder(s).

Pruned mode

If you have a massive project, for example having hundreds of thousands of source lines and hundreds of packages, you’d better resolve cyclic dependencies from upper level in the package tree structure.

But by default, depDetectGui shows each cyclic dependencies of each packages.

In this case you’d better use “Pruned Mode”. This will be explained as the following.

When you have the following packages,

  • a
  • a.b
  • a.b.c
  • a.b.d
  • a.e
  • a.e.f
  • a.e.g

you should “prune” the upper level packages (a.b and a.e), so you will get less number of packages.

  • a
  • a.b
  • a.e

In this case, upper packages will contain the dependencies of “pruned” lower packages.

  • a.b contains the dependencies of a.b.c and a.b.d
  • a.e contains the dependencies of a.e.f and a.e.g

To do this, just check the “Pruned” check box.

Then lower packages will be dissappeared and that dependencies will be included in the upper package.

In this case, there’s no cyclic dependencies because no cyclic dependencies in one package.

Showing depend-to and depend-from

This will be described later.

Showing external references

This will be described later.

Writing files

DepDetectGui writes some files for saving project definitions etc in a H2 database. In case you’re using windows, this will be here.

c:\users\user-name\.depDetect\settings.mv.db
c:\users\user-name\.depDetect\settings.trace.db

Source codes

This application is Open Source software. Except Java Runtime, JUnit, H2 library, you can get all the source codes here.

The following library is also required when you build it.

All sources are in MIT license

Copyright (c) 2018 Cryptomedia Co.,Ltd.
Released under the MIT license
https://opensource.org/licenses/mit-license.php

Posted by ysugimura