Checking for syntax errors

Using the check-syntax goal will parse your C4 source files and display any detected syntax error while failing the build.

It is useful to ensure that PlantUML will be able to generate your diagrams and that these source files will be compatible with any future changes in the grammar.

The C4 grammar in use is more strict than PlantUML’s grammar, to remove any ambiguity.

That goal pretty easy to use as you can only act on the sourceFileExtension property value:

<build>
    <plugins>
        <plugin>
            <groupId>org.thewonderlemming.c4plantuml</groupId>
            <artifactId>c4plantuml-maven-plugin</artifactId>
            <version>1.0.0-RC1</version>
            <executions>
                <execution>
                    <id>checking-syntax-errors-in-c4-files</id>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <sourceFileExtension>.c4</sourceFileExtension>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Given the following directory structure, the previous configuration will only parse .c4 files and ignore everything else:

.
├── pom.xml
└── src
    └── main
        └── resources
            ├── file1.puml
            ├── file1.c4
            └── file2.c4