2

Is it possible to make a Maven plugin to convert the output XML from IntelliJ to PNG in a certain directory in target. Would be nice, because then those diagrams will always be up-to-date after a clean install. It would be nice to use Maven site to publish them and that would make this documentation part of the build / release.

Or if someone would provide the the Java code to convert the XML to PNG (what already is possible in the current UI of IntelliJ by pressing export to file) then I can make the Maven plugin my self.

Example of the output XML file from IntelliJ

<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
  <ID>JAVA</ID>
  <OriginalElement />
  <nodes>
    <node x="0.0" y="980.0">com.example.module.tree.domain.SomeThingTreeConfigurationException</node>
    <node x="578.0" y="628.0">com.example.module.tree.logic.impl.FixedTreeConfigTopic</node>
    <node x="722.0" y="255.0">com.example.module.tree.logic.impl.FixedTreeSomeThingTreeProviderProducer</node>
    <node x="0.0" y="276.0">com.example.module.tree.logic.impl.FixedTreeSomeThingTreeProvider</node>
    <node x="722.0" y="0.0">com.example.module.tree.api.SomeThingTreeProviderProducer</node>
    <node x="743.5" y="114.0">com.example.module.tree.api.ConfigurableSomeThingTreeProviderProducer</node>
    <node x="0.0" y="628.0">com.example.module.tree.domain.SomeThingTreeConfiguration</node>
    <node x="33.0" y="0.0">com.example.module.tree.api.SomeThingTreeProvider</node>
  </nodes>
  <notes />
  <edges>
    <edge source="com.example.module.tree.api.ConfigurableSomeThingTreeProviderProducer" target="com.example.module.tree.api.SomeThingTreeProviderProducer">
      <point x="0.0" y="-45.5" />
      <point x="0.0" y="32.0" />
    </edge>
    <edge source="com.example.module.tree.logic.impl.FixedTreeSomeThingTreeProvider" target="com.example.module.tree.api.SomeThingTreeProvider">
      <point x="0.0" y="-153.5" />
      <point x="0.0" y="113.0" />
    </edge>
    <edge source="com.example.module.tree.logic.impl.FixedTreeSomeThingTreeProviderProducer" target="com.example.module.tree.api.ConfigurableSomeThingTreeProviderProducer">
      <point x="0.0" y="-59.0" />
      <point x="0.0" y="45.5" />
    </edge>
  </edges>
  <settings layout="Hierarchic Group" zoom="1.0" x="257.0" y="253.0" />
  <SelectedNodes>
    <node>com.example.module.tree.logic.impl.FixedTreeConfigTopic</node>
  </SelectedNodes>
  <Categories>
    <Category>Methods</Category>
  </Categories>
  <SCOPE>All</SCOPE>
  <VISIBILITY>private</VISIBILITY>
</Diagram>
Zoe
  • 27,060
  • 21
  • 118
  • 148
Drswaki69
  • 51
  • 6
  • Using XSLT in maven to produce an .svg image would be feasible too. And it allows better zooming in browsers, as UML diagrams can become overcrowded – Joop Eggen Jun 14 '18 at 12:51

3 Answers3

2

I see this question is a couple of years old, but I thought I'd add my alternative Javadoc Doclet to the existing answers for others with the same question, as I haven't found another doclet around that works with Javadoc 9 and newer.

Mine does and you can find it here: https://github.com/talsma-ict/umldoclet

It'd be great if more people could try it out and report feedback.

1

The approach you suggest would make your build pipeline dependent on your IDE, which I think isn't a good idea. Most developers want to be free to choose their tools.

I did find some Maven plugins that generate UML class diagrams. Hope that helps.

Alternatively you could add a command line tool to your sources (checking it into your version control system) and use the exec-maven-plugin to run it.

Rinke
  • 6,095
  • 4
  • 38
  • 55
0

Haven't tried it myself, but maybe you're looking for https://github.com/gboersma/uml-java-doclet?