DepAn now supports Maven dependency visualization

DepAn now supports Maven dependency visualization

DepAn Support For Maven POMs

A recent set of git commits has added Maven POM support to the base DepAn product. Interested users should be able to access these capabilities in any recent build of DepAn. The current Maven support is focused on exploiting DepAn’s dependency visualization capabilities to analyze Maven projects. Several different kinds of elements and relations are supported:

Elements

  • Artifacts
  • Properties

Relations

  • Different relations for each dependency scope (compile, import, provided, runtime, system, and test)
  • Parent
  • Module (aggregation)Properties

The basic analysis package includes a number of pragmatic relation sets. These allow an analyst to quickly sort through the elements and relations to find those components that need attention.

With these definitions, DepAn’s graph analysis and presentation tools can be used to discover (and expose) interesting architectural features. All of DepAn’s graph analysis and diagram rendering features should be fully functional.

There are a number of fairly obvious and desirable UX improvements. A user option for compact labels on the diagram page looks very useful. Work on these enhancements will depend on the interest expressed by users.

Analyzing POM Files

The Maven POM analysis plugin also includes a simple POM file analyzer. This analyzer is available as the New Maven POM Analysis wizard. In the New Maven POM Analysis wizard, the Maven POM field defines the POM file that will be analyzed by the plug. The Browse button allows you to select the source.

For routine analysis of most Maven projects, the Processing option should be set to compute. This directs the Maven POM analysis feature to run the Maven help:effective-pom mojo before analyzing the XML document. The as is value for the Processing option is most useful to process the saved output from Maven’s help:effective-pom mojo. Unless you are analyzing the saved output from that mojo, the Processing options should be set to compute.

Although this analyzer is adequate for many projects, it serves primarily as a prototype for a more robust design. The current analyzer uses the Maven help:effective-pom mojo to resolve the dependencies in each POM. A better solution would be a depan:analyze-dependencies Maven mojo that dumps the entire set of dependencies in the Maven reactor in a single Maven execution.

The current analyzer uses the Maven help:effective-pom to help resolve dependencies. If a master POM aggregates a number of child projects, Maven is executed again for each child project. This process might fail if the POM files have changes since the last build. Best results require a successful Maven build (e.g. clean install) just before using the New Maven POM Analysis wizard.

As project size grows, the number of aggregated projects increases. This can lead to lengthy times for the Maven POM analysis, since a new Maven instance is started for each of the aggregated modules. At some future date, a depan:analyze-dependencies mojo should be able to complete the analysis with a single Maven execution.

Preferences and Configuration

In order to run the Maven POM analyzer, the plugin needs to know the path to the Maven executable and the environment variable JAVA_HOME. Both of these can be configured on the Preferences page, under the Maven POM Analysis entry.

On Windows machine, the Maven Executable should be a file ending with ‘.cmd’. Other file extensions may be appropriate (or irrelevant) on other platforms.

In many cases, the JAVA_HOME provided by the system is the correct one to use. If it is not correct, the Module POM Analysis preference JAVA_HOME can be set to an appropriate directory.

The Effective POM command is rarely changed. It is available mostly for development and debugging purposes.

Leave a comment