Dependency Graphing

We have a listener on the artifact resolver that can be used to track how the dependencies are resolved, which versions are used, and which are eliminated. Currently, only a simple textual representation is available at runtime. We want to be able to do some reporting based on this.

There will be several usage patterns for the resulting graphs.

Identifying dependency exclusions.
Is it excluded, and where did exclusion originate.

Identifying dependency version decisions.
If maven picks another version, which one, and why?

Identifying dependency owner.
If dependency is present in project, how did it get there?
By current project, by transitive dependency, or by parent pom concepts?

Identifying transitive dependency complexity.
Multi module project is getting out of hand, what dependencies can i collapse safely into one dep?

Identify relocated dependencies.
If a dependency was relocated, identify it.

Identify missing or bad dependencies.
If dependency is not found, flag it.

We should allow the user to specify how the graph should be shown.

With nodes representing a unique groupId:artifactId and the edges representing the scope/version ?

With nodes representing a fully unique groupId:artifactId:version and the edges representing the scope?

What should be included?

Just the active dependencies?

The excluded dependencies, but flagged to indicate that they are excluded.

Optional dependencies.

All scopes? (indicate scope somehow. by color?)

Plugins too.

Build Extensions.

Reports.

Current work

Eclipse plugins

Google SoC 2007

Piotr Tabor and Peter Kolbus will create this summer (as a Google Summer of Code participants - with Jason van Zyl and Carlos Sanchez as mentors respectively) a software system that will allow, during the build process of a project, to automatically generate diagrams of chosen aspects of the project.http://docs.codehaus.org/display/MAVENUSER/Maven+Diagram+Maker

Transitive Reduction views of large complex trees are important to get rid of the noise.

Graphviz ( ) is an excellent package for creating graphs and graph images, but it is a native application. If this route is chosen, how do we handle graphviz? As a dependency, or as a configuration parameter to the pre-installed binary?

One shows the multiproject module structure. Details here. Currently just shows the included modules, but showing the non included ones and allowing interaction can be added in the future.

The second one shows the dependencies of a single project. Details and screenshot Scopes are differenciated by color, links from main artifact are highlighted, haven't included version checking so far.

this realm = plexus.core
urls0 = file:/c:/Program Files/apache.org/apache-maven-2.0.8/bin/../lib/maven-2.0.8-uber.jar
Number of imports: 6
import: org.codehaus.classworlds.Entry@4891bb28
import: org.codehaus.classworlds.Entry@f8e44ca4
import: org.codehaus.classworlds.Entry@c51bc9e7
import: org.codehaus.classworlds.Entry@bece5185
import: org.codehaus.classworlds.Entry@3fee8e37
import: org.codehaus.classworlds.Entry@3fee19d8
-----------------------------------------------------INFO ------------------------------------------------------------------------ERROR BUILD ERRORINFO ------------------------------------------------------------------------INFO Internal error in the plugin manager executing goal 'com.agilejava.maven.plugins:maven-overview-plugin:1.0:overview': Unable to find the mojo 'com.agilejava.maven.plugins:maven-overview-plugin:1.0:overview' in the plugin 'com.agilejava.maven.p
lugins:maven-overview-plugin'
org/apache/maven/reporting/AbstractMavenReportINFO ------------------------------------------------------------------------INFO Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'com.agilejava.maven.plugins:maven-overview-plugin:1.0:overview': Unable to find the mojo 'com.agilejava.maven.plugins:maven-overview-plugin:1
.0:overview' in the plugin 'com.agilejava.maven.plugins:maven-overview-plugin'
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:543)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to find the mojo 'com.agilejava.maven.plugins:maven-overview-plugin:1.0:overview' in the plugin 'com.agilejava.maven.plugins:maven-overview-plugin'
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:575)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:425)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
... 16 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Unable to lookup component 'org.apache.maven.plugin.Mojocom.agilejava.maven.plugins:maven-overview-plugin:1.0:overview', it could not be created
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:566)
... 18 more
Caused by: org.codehaus.plexus.component.factory.ComponentInstantiationException: Could not instanciate component: role: 'null', implementation: 'com.agilejava.maven.plugins.overview.MavenOverviewMojo'
at org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
at org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
... 20 more
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/reporting/AbstractMavenReport
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:30)
... 24 moreINFO ------------------------------------------------------------------------INFO Total time: 3 secondsINFO Finished at: Wed Jun 11 14:36:06 CEST 2008INFO Final Memory: 2M/6MINFO ------------------------------------------------------------------------