Skip to content

About

Generate PlantUML class diagrams via UMLDoclet in IntelliJ

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

UMLDoclet UML for IntelliJ IDEA

Right-click Java files, packages or source folders and get PlantUML class diagrams that include field associations, generated by UMLDoclet through your project's own javadoc. It bundles PetalNet's fork of UMLDoclet, which also draws Map fields and, optionally, method dependencies.

demo::Person --> demo::Job: job
demo::Person --> "*" demo::Hobby: hobbies
demo::Person <|-- demo::Manager
shop::GameHub --> "*" shop::Customer: customers      (HashMap<Integer, Customer>)
shop::GameHub ..> shop::Receipt                      (method dependency, opt-in)

Why

The commonly recommended plantuml-parser plugin only draws inheritance; fields that reference other classes never show up as associations (shuzijun/plantuml-parser#30). UMLDoclet does emit them (Person --> Job, Person --> "*" Hobby), but it is a javadoc doclet, not an IDE feature. This plugin wires it into IntelliJ.

What it does

  1. Saves all open documents.
  2. Runs the module SDK's javadoc (not the IDE's JVM) with the bundled UMLDoclet (PetalNet fork, see below) in a temp dir: -private (or -protected), -Xdoclint:none, --ignore-source-errors, --create-puml-files, --uml-image-format none (plus --uml-method-dependencies if enabled). The documented set is exactly the selection: every .java file under the picked folders and every picked file, passed by path through an @argfile. The module's source roots go on -sourcepath and its dependencies on -classpath only so references resolve; for a selection in main sources neither includes test roots or test-scoped dependencies.
  3. Copies only the .puml files into <project>/build/uml/ (package folder structure kept), refreshes the project view and opens the most relevant diagram (the picked class, else the package's package.puml).

Rendering is left to the PlantUML Integration plugin (plantuml4idea), which previews .puml files. This plugin has no renderer of its own; if plantuml4idea isn't installed you get a hint.

Install

Grab umldoclet-intellij-<version>.zip from the latest release, then Settings > Plugins > (gear icon) > Install Plugin from Disk… and pick the zip. Restart when asked.

Requirements: IntelliJ IDEA 2026.2 or newer and a full JDK 9+ as the module/project SDK. A JRE has no bin/javadoc; the plugin tells you if that is the case.

Use

Project view: select one or more Java files, packages or a source folder, right-click, Generate UML (UMLDoclet). In a Java editor: right-click, same entry.

  • A folder (package directory) diagrams the sources under that folder, including subfolders, and nothing else. Classes of the same package in other source roots (tests, other modules, generated sources) are left out.
  • A source root diagrams the sources in that root only.
  • A single file diagrams that file only and opens <Class>.puml.
  • Test sources are only diagrammed when the selection itself is inside a test root.
  • A selection must stay within one module (one javadoc run has one SDK, sourcepath and classpath); a selection spanning modules is rejected with a message. Collecting the sources runs in the background and can be cancelled.

Output: build/uml/<package path>/package.puml (package overview) and one <Class>.puml per type. A notification says how many diagrams were written; failures show the tail of javadoc's output and the full output goes to idea.log (Help > Show Log).

Settings

Settings > Tools > UMLDoclet (stored per project in .idea/umldoclet.xml):

Setting Default Meaning
Output folder build/uml Relative to the project root
Include private members on javadoc -private; off means -protected
Draw field associations as composition (*-->) off See below
Draw method dependencies (..>) off Passes --uml-method-dependencies: A ..> B when a visible method of A takes or returns B (also inside List, Optional, Map, arrays). Skipped where A already has an association to B. Off by default, like the doclet, because it can make diagrams busy

Map fields (HashMap<Integer, Customer> and any other Map subtype) always become an association to the value type (GameHub --> "*" Customer: customers), plus a "<field> key" association when the key type is in the same package. That comes from the fork and needs no setting.

The composition caveat

UMLDoclet draws every field reference as a plain association (A --> B). Java has no way to say whether A owns B (composition) or merely refers to it, so no tool can infer that from source. Some courses want fields drawn as composition anyway; the option rewrites lines matching X --> Y to X *--> Y. Inheritance (<|--), realisation (<|..) and dependencies (..>) are left untouched. It is a blanket rewrite, not an analysis: check the arrows before you hand the diagram in.

Build from source

./gradlew test buildPlugin verifyPluginStructure verifyPlugin

Needs JDK 25 (the Gradle toolchain). The plugin zip lands in build/distributions/. The UMLDoclet jar is PetalNet's fork (PetalNet/umldoclet), built by JitPack from a pinned commit (docletCommit in build.gradle.kts) and checked against docletSha256 by the verifyDocletJar task. It is downloaded by the doclet configuration and shipped as doclet/umldoclet.jar inside the plugin folder; it is never on the plugin's classpath.

./gradlew runIde starts a sandbox IDE with the plugin installed.

License

Apache License 2.0, the same license as the bundled UMLDoclet (copyright Talsma ICT; fork at PetalNet/umldoclet).

About

Generate PlantUML class diagrams via UMLDoclet in IntelliJ

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages