ferstl / depgraph-maven-plugin

A Maven plugin that generates dependency graphs in various formats (DOT, GML, PlantUML, JSON and Text)
Apache License 2.0
563 stars 85 forks source link

feature request : support for other formats than dot #19

Closed mbenabda closed 7 years ago

mbenabda commented 8 years ago

hi there,

I've been looking out there for a maven dependency graph visualization tool for a while, and yours is pretty neat, since it works on multi module projects !

One thing i'd like to see tho, is support for other formats than dot: there are tools out thee such as yEd that are good at visualizing/editing graphs, but don't support the dot format. It would be great if you could extract a rendering api from your code so others (I ?) can implement, for instance, graphml rendering.

could you tell me how that kind of request would stand in your priority list for the plugin, and how i could help ?

merci !

ferstl commented 8 years ago

Hi,

That would definitely require some help but I think integrating other formats than Dot should be doable with the current design of the plugin. Let me think a bit about how this can be done.

mbenabda commented 8 years ago

thanks ! i'll have a look too as soon as i have a chance

Naxos84 commented 7 years ago

I have no idea how this can be done. Though i like to see this feature cause your dependency graph is pretty good i think. If there is anything I can try to help with please let me know.

ferstl commented 7 years ago

Hi, I have been too busy recently to work on this plugin (it is a 100% spare time project). I don't know how other formats, such as yEd, work. So it is a bit difficult to think about how to integrate them. But I guess other formats will also have some kind of node/edege definitions. So an entry point for other formats might be the DotBuildingVisitor class. It walks through the dependencies and finally builds the graph. However, this visitor does not know anything about multi-module projects. It walks through the dependencies module by module.

Another (probably better but more difficult) possibility would be to somehow generify the DotBuilder class. It basically holds a representation of the dependency graph (including modules) and is able to customize the content of the graph by using different "renderers" for dependency nodes and edges (e.g. for the groupId graphs it uses a "renderer" that just ignores the artifactId of each dependency). However, the DotBuilder class is very specific to the Dot format, especially after integrating the new styling feature in version 2 of this plugin.

Naxos84 commented 7 years ago

http://graphml.graphdrawing.org/primer/graphml-primer.html

I will also have a look into those mentioned classes when i have time.

ferstl commented 7 years ago

@mbenabda @Naxos84 I took a look at GraphML and at yEd. I saw that yEd stores most of the graph's content into proprietary tags in the yworks namespace. So instead of creating the proprietary yEd XML (which seems quite difficult) I am thinking of a solution that creates the dependency graph in "standard" GraphML syntax and either employs a XSL style sheet or yEd's Properties Mapper to create a yEd-compatible graph. What do you think?

mbenabda commented 7 years ago

@ferstl Hi, sorry i didn't have as much time to look at this as i expected.

From what i remember, GraphML would be useful to define the graph structure whereas the proprietary yEd part is vizualization focused (i think of it as html/css). The yEd editor seems to support standard graphml, so I would personnaly not bother with the vizualization stuff first. Since the editor allows to group-edit nodes/edges, one could achieve the intended visual look with some rework. I guess the next step could indeed be tackled with the Properties Mapper, or by mimicking the xml produced by the yEd editor when saving :)

thank you so much for looking into this !

Naxos84 commented 7 years ago

Hi @ferstl Yed can handle standard graphml files. So yes this would definitely be a first and good solution. When saving such a file the Yed editor adds all the rest. And as @mbenabda mentioned : tweaking the visualization is pretty easy with yed.

I just locked into maven plugin programming. So it might take a while until I ca bei of greater help than providing Information.

pahan13 commented 7 years ago

Hi All,

Seems like I am not alone who want to inspect maven dependencies with yEd :) So I implemented .GML output format which is supported by yEd. You can find it here in fork https://github.com/pahan13/depgraph-maven-plugin/tree/another-gml-try It is only basic implementation not even tested, but seems it works.

@ferstl Can you please inspect this code? And consider to include it into main repository.

ferstl commented 7 years ago

@pahan13 Thank you for your work! I'll take a look.

ferstl commented 7 years ago

I released version 2.1.0 of the plugin with GML support (should be on Maven Central within the next few hours). It seems work pretty well in yEd:

GML dependency graph in yEd

The integration of another format than DOT required quite some rework on the plugin. This is why it took quite a while to add this feature. But now, integrating further formats will be much easier than before.

Thanks to @pahan13 for pointing out the GML format (which is a bit easier to generate than GraphML) and for providing the PoC implementation!

mbenabda commented 7 years ago

awesome ! thank you so much @pahan13 and @ferstl for working on this !

Naxos84 commented 7 years ago

Apparently neither -DshowDuplicates nor -DshowConflicts does work with yEd It simply creates an edge. no information about duplicate/conflict

ferstl commented 7 years ago

The graph does show duplicates and conflicts if enabled. If -DshowVersion is enabled, the conflicting versions will be shown on the edges (e.g. the edge from module-2 to commons-lang3 in the example above). However the duplicate and conflicting edges look the same as the regular edges. Do you know if its possible to have different edge styles in GML?

Naxos84 commented 7 years ago

Ok. Didn't know that I have to enabled versions to see duplicates. Im sorry.

I digged around for some kind of gml specification. Not to be confused with Geography Markup Language. I found this one: http://www.fim.uni-passau.de/fileadmin/files/lehrstuhl/brandenburg/projekte/gml/gml-technical-report.pdf

I copied the more complex example and modified it. (Added another Node and edge) And then I edited the result with yEd to see what is possible. I attached a file with the content.

Change the file ending of the attached file to ".gml" graph.txt

Hopefully that helps a little bit. When I have time I will also have a look into the plugin to see wether I can help with coding.

ferstl commented 7 years ago

It looks like there only needs to be an additional section like this on the edges:

graphics
[
  style "dashed"
]

I'll create another issue and take a look. Should be easy to implement.

ferstl commented 7 years ago

See #30