PlantUML Macro

Last modified by Vincent Massol on 2023/07/03 00:16

cogMacro and API to generate diagram images using PlantUML
Recommended
TypeJAR
CategoryMacro
Developed by

Maxime Sinclair, Vincent Massol

Active Installs91
Rating
1 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This macro permits to easily generate various diagram types from a textual definition inside a wiki page, using PlantUML.

Usage

{{plantuml}}
content here...
{{/plantuml}}

For more detail see the description of the PlantUML language.

Examples

Use Case Diagram

{{plantuml}}
@startuml
:Customer: -> (Withdraw)
note right of (Withdraw) : This is an example.
@enduml
{{/plantuml}}

Generates:

uc.png

Class Diagram

{{plantuml}}
@startuml
package "Classic Collections" #DDDDDD {
  Object <|-- ArrayList
}

package net.sourceforge.plantuml {
  Object <|-- Demo1
  Demo1 *- Demo2
}
@enduml
{{/plantuml}}

Generates:

class.png

Ditaa Diagram

{{plantuml}}
@startditaa
 Web Browser         JEE Server
 /--------\         +---------+     Database
 +--------+         |c789     |      +---+
 |c1FF    |<------->|  XWIKI  |<-=-->|{s}|
 |  Wiki  |  text   |         |      +---+
 |  page  |         +---------+
 |  with  |         |c789     |      +---+
 |diagrams|<------->|PlantUML |<-=-->|{o}|
 |        |  image  |   Server|      +---+
 \--------/         +---------+     Graphviz
@endditaa
{{/plantuml}}

Generates:

ditaa.png

Configuration

It works out of the box with all the different kinds of diagrams, using the PlantUML server available on the internet. You can also configure the macro to use your own PlantUML server that you can install on the web container used by your XWiki installation (for example). Once installed, internet access is not necessary. Another option is to leave the PlantUML server field empty, in which case the macro will use PlantUML in embedded mode (you'll then need to have GraphViz installed to generate all diagrams except for the Sequence one).

2.0+ 

The PlantUML server configuration is accessible from xwiki.properties by setting the plantuml.server property. For example:

plantuml.server=http://www.plantuml.com/plantuml

It's also accessible from the Admin UI by installing the PlantUML Administration Application.

It's also possible to override the PlantUML server to use when using the macro by using the server parameter, as in:

{{plantuml server="http://www.plantuml.com/plantuml"}}
content here...
{{/plantuml}}

If a PlantUML server is specified in the Admin UI, then you can force not using any server at the level of the macro by specifying an empty server parameter, as in:

{{plantuml server=""}}
content here...
{{/plantuml}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


If you were using version 1.1, note that the PlantUML server configuration location has changed, see above.

Release Notes

v2.1.1

v2.1

v2.0.2

v2.0.1

And also make it possible to upgrade from versions 1.x using the Extension Manager (without having to uninstall v1.x first).

v2.0

v1.1

If a previous version is installed, remove it before installing this new one.

With the new include parameter, you can include the content of the specified page at the begining of the macro content. It's similar to the !include directive of PlantUML http://plantuml.sourceforge.net/preprocessing.html
It is very useful to locate skin directives in an unique place.

v1.0

If a previous version is installed, remove it before installing this new one.

The macro works out of the box with all the different kinds of UML diagrams, using the PlantUML server available on the internet. But you can configure the macro to use your own PlantUML server.
An embedded version of PlantUML server is also available. To use it, just leave empty the Server configuration entry.

Diagrams larger than the page are now resized to avoid the horizontal scrollbar.

v0.7

plantuml.jar is embedded in the macro, so is not more required to install plantuml.war.

Graphviz still required for some Diagram like Use Case diagram

v0.6

Initial version.

Dependencies

Dependencies for this extension (org.xwiki.contrib.plantuml:macro-plantuml-macro 2.1.1):

Tags: UML ditaa
    

Get Connected