Skip to content

✅ Build-time Validation

Experimental

The validateBpmnModels Gradle task and validate-bpmn Maven goal are experimental. The API may change in a future release.

bpmn-to-code can validate your BPMN models against a set of built-in rules — independently of code generation. Validation runs during your build and fails CI if your models violate any rules.

What It Checks

Rule IDSeverityWhat it catches
missing-service-task-implementationERRORService task with no implementation (no jobType / delegateExpression / class)
missing-message-nameERRORMessage event or receive task with no message name
missing-error-definitionERRORError boundary/end event with no error definition
missing-signal-nameERRORSignal event with no signal name
missing-timer-definitionERRORTimer event with no timer type or value
missing-called-elementERRORCall activity with no calledElement reference
missing-element-idERRORFlow node with no ID
missing-process-idERRORProcess with no id attribute
empty-processERRORProcess with no flow nodes
invalid-identifierWARNElement ID that produces an invalid UPPER_SNAKE_CASE identifier in the generated API
collision-detectionERRORTwo different element IDs that normalize to the same constant name (post-merge)

Gradle

Configuration

kotlin
tasks.named("validateBpmnModels", ValidateBpmnModelsTask::class) {
    baseDir = projectDir.toString()
    filePattern = "src/main/resources/**/*.bpmn"
    processEngine = ProcessEngine.ZEEBE
    failOnWarning = false                          // optional — treat warnings as errors
    disabledRules = setOf("invalid-identifier")   // optional — skip specific rules
}

Running

bash
./gradlew validateBpmnModels

The task is registered automatically by the plugin. It runs independently of generateBpmnModelApi — you can run validation without generating code.

Example output

> Task :validateBpmnModels
[EXPERIMENTAL] The 'validateBpmnModels' task is experimental and may change in future releases.
[BPMN VALIDATION WARN]  newsletterSubscription/Activity_SendWelcomeMail: Service task has no implementation. Add a zeebe:taskDefinition with a type attribute. (rule: missing-service-task-implementation)
[BPMN VALIDATION ERROR] newsletterSubscription/Timer_EveryDay: Timer event has no timer definition. (rule: missing-timer-definition)

> Task :validateBpmnModels FAILED
BPMN validation failed: 1 error(s), 1 warning(s)

Maven

Configuration

xml
<plugin>
    <groupId>io.github.emaarco</groupId>
    <artifactId>bpmn-to-code-maven</artifactId>
    <version>2.0.1</version>
    <executions>
        <execution>
            <id>validate-bpmn</id>
            <goals><goal>validate-bpmn</goal></goals>
            <phase>verify</phase>
            <configuration>
                <baseDir>${project.basedir}</baseDir>
                <filePattern>src/main/resources/**/*.bpmn</filePattern>
                <processEngine>ZEEBE</processEngine>
                <failOnWarning>false</failOnWarning>
                <!-- optional: disable specific rules -->
                <disabledRules>
                    <disabledRule>invalid-identifier</disabledRule>
                </disabledRules>
            </configuration>
        </execution>
    </executions>
</plugin>

Running

bash
mvn verify
# or directly:
mvn bpmn-to-code:validate-bpmn

Parameters

ParameterTypeDefaultDescription
baseDirStringrequiredBase directory for resolving relative paths
filePatternStringrequiredGlob pattern to locate BPMN files
processEngineProcessEnginerequiredZEEBE, CAMUNDA_7, or OPERATON
failOnWarningBooleanfalseTreat WARN-severity violations as build failures
disabledRulesSet<String>emptySet()Rule IDs to skip

Disabling Rules

Pass rule IDs to disabledRules to skip specific checks:

kotlin
tasks.named("validateBpmnModels", ValidateBpmnModelsTask::class) {
    disabledRules = setOf("invalid-identifier", "empty-process")
}
xml
<disabledRules>
    <disabledRule>invalid-identifier</disabledRule>
    <disabledRule>empty-process</disabledRule>
</disabledRules>

Writing Custom Rules in Tests

The build-time validation covers the most common issues. For project-specific conventions, use the Testing Module to write your own rules as part of your test suite.