degraph icon indicating copy to clipboard operation
degraph copied to clipboard

Introduce maven-based visualization plugin

Open smagellan opened this issue 10 years ago • 7 comments

E.g. look at sonar: it is possible to invoke sonar analysis even without altering project's pom.xml: just alter your global setting.xml(example: https://gist.github.com/nkabir/2159177 ), then execute mvn sonar:sonar. Is it hard to introduce same functionality(degraph maven plugin) into Degraph suite?

smagellan avatar Nov 03 '15 10:11 smagellan

This would certainly be possible and AFAIK all one needs for this is a maven plugin for Degraph. Although I never wrote a Maven plugin, it's supposedly rather easy.

Unfortunately my time is very limited and a Maven plugin isn't very high on my list of priorities. So I won't implement this in the foreseeable future.

But if somebody else wants to do it, I'll support the effort (setting it up in the build file, making modifications to the core if necessary, accepting the pull request ..).

schauder avatar Nov 03 '15 10:11 schauder

I did not write them before, too. Excellent reason to try.

smagellan avatar Nov 03 '15 13:11 smagellan

If you want to do it you have two options:

  • create your own project depending on degraph core
  • or create a new module in this project and make a pull request.

If you want follow one of these roads, let me know, I can put together some pointers how to get started with the degraph side of things

schauder avatar Nov 03 '15 19:11 schauder

The implementation of the plugin would be rather easy I guess, however, building a maven plugin using gradle is not directly possible (AFAIK). You can have a look at the jgiven-maven-plugin, which also uses gradle, but requires maven behind the scenes for building the plugin: https://github.com/TNG/JGiven/tree/master/jgiven-maven-plugin

janschaefer avatar Nov 04 '15 05:11 janschaefer

@janschaefer, thank you, I will take a look.

smagellan avatar Nov 06 '15 09:11 smagellan

@schauder, I like option no. 2: new module in this project. I have 2 questions:

  1. How to embed degraph into application? How gradle plugin embeds and runs core? It is good idea to share execution interface between gradle and maven plugins.
  2. How to build settings and feed it into core?

smagellan avatar Nov 06 '15 10:11 smagellan

The plugin would have a dependency on degraph-core so it can use the Degraph functionality.

For how to use it, probably the best is to look at the Degraph main method: https://github.com/schauder/degraph/blob/master/degraph/src/main/scala/de/schauderhaft/degraph/app/Degraph.scala

You create a Configuration instance, pass in an (Analyzer)[https://github.com/schauder/degraph/blob/master/core/src/main/scala/de/schauderhaft/degraph/analysis/asm/Analyzer.scala] and get out a (Graph)[https://github.com/schauder/degraph/blob/master/core/src/main/scala/de/schauderhaft/degraph/graph/Graph.scala], which contains information about violations of Constraints.

schauder avatar Nov 07 '15 13:11 schauder