leobenkel / umlclassdiagram   1.2.0

Website GitHub

SBT Plugin to draw a UML Class Diagram

Scala versions: 2.12
sbt plugins: 1.0

umlclassdiagram example

UML Class Diagram for Scala

License: MIT release-badge maven-central-badge CI-CD BCH compliance Coverage Status

Inspired by xuwei-k/sbt-class-diagram

Table of Contents

Table of content generated by gh-md-toc



You are required to install Graphviz to generate the SVG from the dot file.

If you do not need the generation of the SVG file, you can apply this setting:

classDiagramSettings := classDiagramSettings.value.copy(generateSvg = false)

in your build.sbt.

Enable plugin

First add

addSbtPlugin("com.leobenkel" % "umlclassdiagram" % "[VERSION]")

to project/plugin.sbt

Version: maven-central-badge

and then


to build.sbt

Which connections would you like to show?

To change which connection you would like to display, add this:

classDiagramSettings :=
      enabledConnectionTypes =

to your build.sbt.

The possibilities are:

  • Inherit
    • will connect the classes with their parent trait and classes
    • This is the default behavior.
  • Produce
    • Will connect the classes to the classes that can be returned
    • Will not find out about generic type like Seq[A] or Foo[A]
  • Consume
    • Will connect the classes to the classes that are used as arguments
  • Throw
    • Will connect the classes to the classes being thrown
  • Enclosing
    • Will connect the classes to the parent class where the class is defined is it exist.


You can read more about the key/values available for dot graph styling with this document: https://www.graphviz.org/pdf/dotguide.pdf .


To analyze a specific class:

sbt classDiagram path.to.Class

To browse entire package:

sbt classDiagram path.to.package.*

And those can be combined:

sbt classDiagram path.to.Class path.to.package.* pack.to.other.Class


To open the folder with output files and/or the SVG image

classDiagramSettings := classDiagramSettings.value.copy(openFolder = true, openSvg = true)

in your build.sbt.

To change the name of the file

classDiagramSettings := classDiagramSettings.value.copy(name = "foo")

in your build.sbt.


Leo Benkel

  • leobenkel-github-badge
  • leobenkel-linkedin-badge
  • leobenkel-personal-badge
  • leobenkel-patreon-badge