Plugin architecture
The plugin is structured as a set of layers:
- A plugin libraries layer builds high level features on top of external libraries.
- A Maven Objects layer composes the features, building on top of the Maven API.
- The Plugin itself, which is a set of configuration files and code that ties everything together.
You can find more about the dependencies versions and tree (direct and/or transitive) on the dependencies page.
Plugin layers details:
Syntax checking
The backbone of the syntax-checking feature is the SyntaxChecker component. It parses a given C4 source file and reports any encountered syntax error or grammar ambiguity.
For now it is fairly simple but it might grow in the future to become able to display nice specialized error messages.
Watermarking
The watermarking feature is maybe the easiest to understand. It does not even rely on a library, but rather handles the watermarking directly within its own MOJO.
Linting
The linting feature is a bit more complicated to look at.
Library layer
That layer contains the actual linting engine implementation. The linter component parses a given C4 source file and triggers each active linting rule on that parsed file syntax tree, in order to find and report any linting violation.
MOJO layer
That layer defines a set of classes that extend the linting library’s AbstractLintingRule class, allowing users to define their own rules without having to ship them with the plugin.
It relies on the ClassGraph library to discover linting rules in the classpath (including within the project dependencies).
Finally, the Linting MOJO configures and makes use of all these components to lint the project C4 source files.
Reporting
The reporting feature has a lot of components, because it generates and validates XML in Java, but is it fairly simple.
The library is organized around a C4Graph class, which delegates the parsing of a given C4 source file and the building of a GraphModel object. Each C4 source file is added to the model one by one.
Once the model is complete, the model is serialized to XML (GraphML format ) and validated against the official XSD set, using the GraphMLModelExporter.


