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
Teh Eclipse plugin Q4E includes dependency graph and dependency analysis views.
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
Grafo
Carlos has put together a initial version done with http://prefuse.sourceforge.net/
- http://people.apache.org/~carlos/grafo/graphview.html
- http://people.apache.org/~carlos/grafo/radialgraphview.html
It's under the maven sandbox at https://svn.apache.org/repos/asf/maven/sandbox/grafo
plexus-graph-visualization
Jason van Zyl is planning on overhauling the entire gathering and resolution of artifacts using the plexus-graph library. A visualization suite has already been created for it.
- http://svn.codehaus.org/plexus/plexus-sandbox/trunk/plexus-components/plexus-graph/
- http://svn.codehaus.org/plexus/plexus-sandbox/trunk/plexus-components/plexus-graph-visualization/
Other Resources
From Joakim:
- http://www.graphviz.org/ - Graphviz support exists in the plexus-graph-visualization
- plexus-graph-visualization - has providers for prefuse, graphviz, and touchgraph.
- Grouping / Clustering support is important for large projects.
- 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?
From Carlos:
- http://www.workingfrog.org/ a 3D view of java projects and dependencies
- http://prefuse.sourceforge.net/ the gallery shows amazing examples with interactive graphs in applets (BSD license)
From Jason:
- http://jung.sourceforge.net/ - Java Universal Network/Graph Framework
From Wim:
- http://www.xml.com/pub/a/2004/09/08/tree.html
- http://www.linguiste.org/syntax/tree/drawer/
- http://www.svgopen.org/2005/papers/ComparisonXML2SVGTransformationMechanisms/
They show how to convert an xml tree structure to a SVG image.
From Milos Kleint:
- I've written 2 graphs for the Netbeans integration. Both are based on the Netbeans graph library.
- 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.
From Joakim:
Ambitusgraph: https://svn.sventech.com/repos/joakim/projects/trunk/ambitusgraph/
Currently an interactive dependency viewer experiment.
Example of current functionality.

8 Comments
Hide/Show CommentsMay 05, 2006
Dimitry Voytenko
Hi,
I just tried to build https://svn.apache.org/repos/asf/maven/sandbox/grafo from SVN. It doesn't build under Jdk 1.4. Error message is:
Is this intended? Does it only compile under 1.5?
May 01, 2007
Frederic Simon
Hi,
Starting from this initial work we just released a maven2 dependency viewer more info here:
http://www.jfrog.org/sites/dependency-viewer/1.0/index.html
It needs JDK 1.5.
May 15, 2007
Jerome Jar
Hi,
Seems the grafo has been moved to https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/grafo/grafo-maven-plugin/
Feb 10, 2008
Hubert Iwaniuk
Hi All,
We have created maven-overview-plugin it provides graphical overview of projects dependencies.
It can be used both standalone (command line) as well as report.
Hope you find it useful
Jun 11, 2008
gennady berezh
Hi Hubert,
i just comes back to your plugin, but still build produce the only pbs :
...
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
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 ERROR
INFO ------------------------------------------------------------------------
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/AbstractMavenReport
INFO ------------------------------------------------------------------------
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 more
INFO ------------------------------------------------------------------------
INFO Total time: 3 seconds
INFO Finished at: Wed Jun 11 14:36:06 CEST 2008
INFO Final Memory: 2M/6M
INFO ------------------------------------------------------------------------
what i am doping wrong?
Jun 12, 2008
Hubert Iwaniuk
Hi Gennady,
Please use project mailing list to report bugs.
Thank you,
Hubert.
Jun 12, 2008
gennady berezh
Hi Hubert,
Sure! Done.
BTW r u plan to fix it? If yes - when aprox?
Kindest regards,
Gennady.
Aug 01, 2008
Hubert Iwaniuk
Hi Grennady,
It's been fixed some time ago.
Please take a look at plugin site again.
Cheers,
Hubert.