Plugins You can find out about all the publicly available Grails plugins.

Class diagram plugin

  • Authors: null
18 votes
compile "org.grails.plugins:class-diagram:0.5.2"

 Source  Issues



Install graphviz dot utility

This plugin uses the graphviz dot utility to layout graphs. Download and make sure its on your path (or, set the path to the graphviz dot utility in Config.groovy: property=/full/path/to/dot-executable).

You should check to see that your graphviz is not too old. There is a known issue using a pre-Snow Leopard-graphviz version on Snow Leopard (Mac OS X 10.6.x).

Install the plugin

grails install-plugin class-diagram [-global]
Use the -global flag if you want the class diagram to be available globally, ie. for all your grails projects.


This plugin does not work with grails 2.0 yet!

The ClassDiagram plugin

The ClassDiagram plugin provides an UML-like diagram of your grails domain classes.


After installation (see the installation tab), a class diagram of our domain classes should be available under http://localhost:8080/yourApp/classDiagram:

Changing diagram preferences

You can change your diagram preferences in the preferences dialog. Most items provide a tooltip for details.

New for version 0.5 is the class filtering edit box. Check the tooltip for samples!


The following relations are recognized:

Configuration file

Below follows a copy of the plugins configuration. It is easy to override: just pick one or more of the properties you want to change and add it to your Config.groovy.

Yo can change diagram appearance (such as colors and node/edge shapes), and you may create your own skins. You also can change most graphviz attributes.

If you don't want to clutter your Config.groovy file, you can also change the plugin configuration. If, for instance, the plugin is installed globally you will find the config file under something like ~/.grails/1.2.0/global-plugins/grails-class-diagram-0.5.1/conf/ClassDiagramConfig.groovy.

 * Default properties. May be overridden in Config.groovy for each project
graphviz {
    dot.executable = "dot" // include full file path if not on path

classDiagram { preferences { defaults { // Defaults used in preferences form. skin = "regular" outputFormat = "png" // Should be an image format from showProperties = true showMethods = true showAssociationNames = true showMethodReturnType = true showMethodSignature = false showPropertyType = true showEmbeddedAsProperty = false showPackages = false autoUpdate = true classSelection = "<all>" classSelectionIsRegexp = false graphOrientation = "TB" // See for valid values fontsize = 9 } } associations { arrows { // See for available arrowheads and their visual appearance references = "open" belongsTo = "odiamond" embedded = "diamond" inherits = "onormal" none = "none" } decorators { // plain text to be shown on edge ends hasOne = "1" hasMany = "*" none = "" } } skins { // See for available properties on graph, node and edge. // You may use any property except the 'shape' property (it is set internally to [shape:'record']). // Also, if you use the fontsize property, the gui size slider will not be able to override it. classic { name = "Classic" graphStyle = [bgcolor:"white"] nodeStyle = [style:"rounded,filled", color:"blue", fillcolor:"azure2", fontname:"Verdana"] edgeStyle = [color:"gray40", fontname:"Verdana"] packageStyle = [style:"rounded,filled", color:"gray95", fontname:"Verdana"] } classicSpaced { name = "Classic Spaced" graphStyle = [bgcolor:"white", mclimit:100, nodesep:'0.75 equally', ranksep:'0.75 equally'] nodeStyle = [style:"rounded,filled", color:"blue", fillcolor:"azure2", fontname:"Verdana", fontsize:18] edgeStyle = [color:"gray40", fontname:"Verdana", fontsize:18, labelfontsize:20, labeldistance:3.5] packageStyle = [style:"rounded,filled", color:"gray95"] } regular { name = "Regular" graphStyle = [bgcolor:"white"] nodeStyle = [style:"filled", color:"lightyellow3", fillcolor:"lightyellow", fontname:"Verdana"] edgeStyle = [color:"gray40", fontname:"Verdana"] packageStyle = [style:"filled", color:"gray95", fontname:"Verdana"] } white { name = "White on Gray" graphStyle = [bgcolor:"gray90"] nodeStyle = [style:"filled", color:"gray40", fillcolor:"white", fontname:"Verdana"] edgeStyle = [color:"gray40", fontname:"Verdana"] packageStyle = [style:"", color:"gray40", fontname:"Verdana"] } gray { name = "Gray" graphStyle = [bgcolor:"white"] nodeStyle = [style:"filled", color:"gray40", fillcolor:"gray90", fontname:"Verdana"] edgeStyle = [color:"gray40", fontname:"Verdana"] packageStyle = [style:"filled", color:"gray95", fontname:"Verdana"] } } legend { style { graphStyle = [bgcolor:"gray94", margin:"0,0", size:"7,7"] nodeStyle = [style:"filled", color:"gray50", fillcolor:"white", margin:"0,0", fontsize:15, fontname:"Verdana"] edgeStyle = [color:"gray50", fontsize:15, fontname:"Verdana"] packageStyle = [style:"filled", color:"gray94", fontname:"Verdana"] } } }


Thanks to Merlyn Albery-Speyer's blogs on the subject. The DotBuilder was based on his idea. Also thanks to Frank Schoep for his blog on UML diagrams using graphviz. And of course thanks to the people behind the fantastic graphviz utility.

Release notes

0.5.2 Fixes

  • GRAILSPLUGINS-2431 - java.lang.StackOverflowError
  • GRAILSPLUGINS-2501 - Decorations on arrow tails, such as belongsTo, inherits etc. has disappeared
  • GRAILSPLUGINS-2504 - Installation should not fail if graphviz is not installed/not on path.
0.5.1 Fix
  • GRAILSPLUGINS-1931 - Associations now shows up as properties
0.5 Fixes & features
  • GRAILSPLUGINS-1587 - Enum classes appears outside all package (when using package view)
  • GRAILSPLUGINS-1618 - In One-to-Many relationships the belongsTo diamond is not always shown by class-diagram.
  • GRAILSPLUGINS-1926 - css files in show.gsp are not correctly referenced
  • GRAILSPLUGINS-1740 - Too many inheritance associations
  • GRAILSPLUGINS-1589 - User should be able to select domain class subset
0.4.1 Fixes
  • GRAILSPLUGINS-1607: java.lang.StringIndexOutOfBoundsException for 1-char-long property names.
  • GRAILSPLUGINS-1583: Show association name from both directions
0.4 Fixes & Features.
  • GRAILSPLUGINS-1559: WAR-packaged application fails to start if deployed with Class diagram plugin
  • Default preferences configurable.
  • Classes can now be shown grouped in packages
  • Graphviz 2.24 fix: translates bgcolor:none to black, while prior versions translate to white! Fixed
  • Default outputFormat is now png
  • Properties page now initially invisible
  • Non-image outputFormats like svg and pdf now works, even from form
  • New skin, classicSpaced, that use graphviz options to get more 'space' around nodes. Contributed by Gavin Kromhout.
  • Preferences defaults can now be configured
  • Legend: not loaded before required, and brushed up
  • GUI form state fixes: Hiding menu now conservers preferences; enter-key now synonymous with pushing 'Update'.
  • DotBuilder now supports subgraphs
  • Added property for graph orientation: top to bottom or left to right
  • (cleaned up CSS a bit)
  • (reformatted code to 4 spaces indentation, not tabs)
0.3 Brush-up. Added support for embedded objects, provided a GUI for changing properties, re-ordering

0.2 Bugfix. Removed domain classes in sub-packages when packaging plugin.

0.1 Initial release


See JIRA for the official backlog and doc/NOTES.txt for details and future ideas.


The project is now (from version 0.5.2) hosted on