My favorites | Sign in
Project Logo
q4e
                
Search
for
Updated Apr 24, 2008 by jake.pezaro
DependencyAnalysis  
Analysis of dependencies in Maven projects

Introduction

The Analyse Dependencies view shows a tree view of a project's direct and transitive dependencies which can be used in debugging common dependency problems. In addition it also provides some advanced dependency management features.

Debugging Features

Dependency Management Features

View Details & Terminology

Primary Selection

This is the item that you have selected, it could be in any of the three panes. It will be coloured orange.

Secondary Selections

These are the items that are "related" to your primary selection. For example if you select a particular version from the Versions Pane, the related items are the corresponding artifact in the Artifacts Pane and the instances of that version in the Instances Pane. These will be coloured yellow.

Tertiary Selections

These only appear in the Instances Pane and are coloured light yellow. They represent the parent instances of the currently selected Instances. They are there primarily to indicate the path from the tree root to selected instances.

Instances Pane

Shows the tree of transitive dependencies. Each item in the tree is an instance of a dependency, and a given dependency may appear many times in the same tree. Selecting an item in this pane will highlight the corresponding version and artifact in the other panes.

Versions Pane

Shows a sortable list of all dependencies including the version of the artifact. The Instances column shows a count of the number of times that a given dependency appears in the dependency tree. Selecting an item in this pane will highlight the corresponding instances in the Instances Pane and artifact in the Artifacts Pane.

Artifacts Pane

Shows a sortable list of all dependencies without the version information. The versions column indicates the number of different versions of that artifact in the dependency tree, which is very useful for finding artifacts with more than one version. Selecting an item in this pane will highlight the corresponding versions and instances in the other panes.

Using the Dependency Management Features

In order to use the dependency management features you simply need to right-click an artifact in the Artifacts Pane and select the option that you want. Both of these options will alter the dependencyManagement and dependency sections of the project's pom file. Please note that after executing one of these features you must re-analyse the dependencies in order to see your changes reflected in the viewer, you may also want to reformat the pom file (CTRL+SHIFT+F).

Force Version

Force Version utilises maven's dependencyManagement section of the pom.xml to ensure that the version of the selected artifact is a specific version, or within a certain version range. Selecting the Force Version option from the right-click menu will show the below dialog, from which the required version can be specified. Selecting cancel will cancel the operation without making any changes.

The Currently Selected item is the version that maven has currently resolved. All other versions present in the tree will be listed. The "Other" text field allows you to either enter a version not already in the tree or a version range expression.

Exclude All

Exclude All utilises maven's dependencyManagement and dependency sections of the pom.xml to ensure that the selected artifact is completely removed from the dependency tree. Selecting the Exclude All option from the right-click menu will show the below dialog. Selecting cancel will cancel the operation without making any changes.

Extensibility

The dependency analysis view exposes the Artifact, Version and Instance objects for extension. Providing a context menu item for these items involves:

Extensability Examples

Examples of how to declare extensions can be found in the plugin.xml. Examples of the actions can be found at Exclude All Action and Force Version Action.

Hosted by Google Code